From: Jo-Philipp Wich Date: Thu, 22 Oct 2015 19:07:40 +0000 (+0200) Subject: luci-theme-material: do not infer login state from url (#520) X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f9e590a;p=oweals%2Fluci.git luci-theme-material: do not infer login state from url (#520) 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 `` element if a session exists. Signed-off-by: Jo-Philipp Wich --- diff --git a/themes/luci-theme-material/htdocs/luci-static/material/js/script.js b/themes/luci-theme-material/htdocs/luci-static/material/js/script.js index a0f067595..fdd23e8cd 100755 --- a/themes/luci-theme-material/htdocs/luci-static/material/js/script.js +++ b/themes/luci-theme-material/htdocs/luci-static/material/js/script.js @@ -144,11 +144,10 @@ 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{ diff --git a/themes/luci-theme-material/luasrc/view/themes/material/header.htm b/themes/luci-theme-material/luasrc/view/themes/material/header.htm index 99afc065b..153be101a 100755 --- a/themes/luci-theme-material/luasrc/view/themes/material/header.htm +++ b/themes/luci-theme-material/luasrc/view/themes/material/header.htm @@ -135,7 +135,7 @@ - +