Checking for `;` in the url is no good indicator whether a user is logged in,
instead query the dispatcher and set a `logged-in` CSS class on the `<body>`
element if a session exists.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
function getCurrentNodeByUrl() {
var ret = false;
var getUrlNode = function (href){
- var linkPos = href.indexOf(";");
- if (linkPos == -1){
+ if (!$('body').hasClass('logged-in')){
return "login";
}else{
- linkPos = href.indexOf("/", linkPos);
+ var linkPos = href.indexOf("/", linkPos);
if (linkPos == -1){
return "overview";
}else{
<script src="<%=resource%>/xhr.js"></script>
</head>
-<body class="lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %>">
+<body class="lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %>">
<header>
<div class="container">