ui: hide or show login button

This commit is contained in:
Jean-Baptiste Pasquier 2019-06-05 13:26:58 +02:00
parent 89db25fa85
commit 522237b4d2
No known key found for this signature in database
GPG Key ID: F2702E6D22ED4D62

View File

@ -25,4 +25,15 @@ document.addEventListener('DOMContentLoaded', function (event) {
})
});
//- Header login hide/show
if(document.querySelector('sib-auth').getUser() !== null) {
document.querySelector('button[role="log in"]').style.display = 'none';
//- Token expired, hack for ask relogin
if(new Date(document.querySelector('sib-auth').getUser().expires_at*1000) <= new Date()) {
document.querySelector('button[role="log in"]').style.display = '';
document.querySelector('button[role="log in"]').style.color = 'red';
document.querySelector('button[role="log in"]').innerHTML = 'Re-login';
}
}
});