mirror of
https://github.com/openwrt/luci.git
synced 2026-08-29 06:22:49 +04:00
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 `<body>` element if a session exists. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
@@ -144,11 +144,10 @@
|
|||||||
function getCurrentNodeByUrl() {
|
function getCurrentNodeByUrl() {
|
||||||
var ret = false;
|
var ret = false;
|
||||||
var getUrlNode = function (href){
|
var getUrlNode = function (href){
|
||||||
var linkPos = href.indexOf(";");
|
if (!$('body').hasClass('logged-in')){
|
||||||
if (linkPos == -1){
|
|
||||||
return "login";
|
return "login";
|
||||||
}else{
|
}else{
|
||||||
linkPos = href.indexOf("/", linkPos);
|
var linkPos = href.indexOf("/", linkPos);
|
||||||
if (linkPos == -1){
|
if (linkPos == -1){
|
||||||
return "overview";
|
return "overview";
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -135,7 +135,7 @@
|
|||||||
<script src="<%=resource%>/xhr.js"></script>
|
<script src="<%=resource%>/xhr.js"></script>
|
||||||
</head>
|
</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>
|
<header>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
Reference in New Issue
Block a user