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

View File

@ -13,7 +13,8 @@ html(lang="en")
body body
header#header(role='banner') header#header(role='banner')
include header.pug include header.pug
main
main.notLoggedIn
include menu-left.pug include menu-left.pug
div#viewport div#viewport

View File

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

View File

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

View File

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