update: redirect to login and hide page on logged out

This commit is contained in:
Jean-Baptiste Pasquier 2020-02-19 17:03:47 +01:00
parent 8042b179c6
commit 3e14cb91a4
No known key found for this signature in database
GPG Key ID: F2702E6D22ED4D62
5 changed files with 13 additions and 10 deletions

View File

@ -7,7 +7,7 @@
//- i#search-icon.icon-magnifier(aria-hidden='true')
//- i#close-search-icon.icon-close(aria-hidden='true')
sib-notifications(
sib-notifications.notLoggedIn(
nested-field="inbox"
bind-user
)
@ -33,11 +33,11 @@ details#user-controls.notLoggedIn
sib-link(next='admin') Admin
button(role='log out' onclick="document.querySelector('sib-auth').logout();") Log out
button(role='log in' onclick="document.querySelector('sib-auth').login();") Login
button.loggedIn(role='log in' onclick="document.querySelector('sib-auth').login();") Login
button.notLoggedIn.mobile-menu-icon.icon-menu#toggleMainMenu
sib-auth
sib-auth(style='display:none!important')
sib-auth-provider(
data-authority=`${authority}`
data-id=`${authorityName || "authority"}`

View File

@ -13,7 +13,8 @@ html(lang="en")
body
header#header(role='banner')
include header.pug
main
main.notLoggedIn
include menu-left.pug
div#viewport
@ -42,4 +43,4 @@ html(lang="en")
include page-events.pug
#admin(hidden).with-sidebar
include page-admin.pug
include page-admin.pug

View File

@ -214,7 +214,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
.forEach(el => (el.style.visibility = "visible"));
// Hide login button if already logged
document
.querySelector('button[role="log in"]')
.querySelector('.loggedIn')
.setAttribute("style", "display:none !important");
document.querySelectorAll('sib-display, sib-form').forEach(element => {
// Set current user id on set-user-id of sib-display
@ -228,6 +228,8 @@ document.addEventListener("DOMContentLoaded", function(event) {
"display:none !important"
); // Hide Join button
}
} else {
document.querySelector('sib-auth').login();
}
})
.catch(error => console.log(error));

View File

@ -56,10 +56,6 @@
}
}
.notLoggedIn {
visibility: hidden;
}
sib-notifications {
@include breakpoint(sm) {

View File

@ -35,6 +35,10 @@ $breakpoints: (phone: 480px,
backface-visibility: hidden;
/*will-change: overflow;*/
}
.notLoggedIn {
visibility: hidden;
}
}
/* Add scrollbar to the left and right menu, and to the content */