feature: do not login if in the login process

This commit is contained in:
Jean-Baptiste Pasquier 2021-07-05 23:18:29 +02:00
parent 578cd34b53
commit a546792e39
4 changed files with 12 additions and 6 deletions

View File

@ -2,7 +2,8 @@ window.requestLogin = false;
document.addEventListener("DOMContentLoaded", function () {
const sibAuth = document.querySelector("sib-auth");
const timeoutNoUser = setTimeout(() => {
sibAuth.login();
if(!(new URLSearchParams(window.location.search)).get('code'))
sibAuth.login();
}, 15000);
if (sibAuth) {
sibAuth.getUser()
@ -58,6 +59,7 @@ if (loginButton) {
setTimeout(() => {
document.querySelector('#something-goes-wrong').removeAttribute('hidden');
}, 5000);
document.querySelector('sib-auth').login();
if(!(new URLSearchParams(window.location.search)).get('code'))
document.querySelector('sib-auth').login();
});
}

View File

@ -82,7 +82,8 @@ document.addEventListener("DOMContentLoaded", function () {
if (window.location.pathname == "/login") {
const sibAuth = document.querySelector("sib-auth");
const timeoutNoUser = setTimeout(() => {
sibAuth.login();
if(!(new URLSearchParams(window.location.search)).get('code'))
sibAuth.login();
}, 15000);
if (sibAuth) {
sibAuth.getUser()
@ -129,7 +130,8 @@ document.addEventListener("DOMContentLoaded", function () {
if (e.detail.route.startsWith('login')) {
const sibAuth = document.querySelector("sib-auth");
const timeoutNoUser2 = setTimeout(() => {
sibAuth.login();
if((new URLSearchParams(window.location.search)).get('code'))
sibAuth.login();
}, 15000);
if (sibAuth) {
sibAuth.getUser()

View File

@ -14,7 +14,8 @@ import(`https://cdn.skypack.dev/@startinblox/core@${core.version}`).then(core =>
}
}),
);
document.querySelector("sib-auth").login();
if(!(new URLSearchParams(window.location.search)).get('code'))
document.querySelector("sib-auth").login();
}
}
});

View File

@ -3,7 +3,8 @@ document.addEventListener('DOMContentLoaded', () => {
if (userCreationForm) {
userCreationForm.addEventListener('save', event => {
if (event.originalTarget.id == 'user-creation-form') {
document.querySelector("sib-auth").login();
if(!(new URLSearchParams(window.location.search)).get('code'))
document.querySelector("sib-auth").login();
}
});
}