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

View File

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

View File

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

View File

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