Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
hu8813 committed Apr 22, 2024
1 parent 40d77da commit 547f282
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions srcs/frontend/js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ const routes = {
"#manage2fa" : "/views/manage2fa.html",
};


let msgReg ;
const hashParamsString2 = window.location.hash.substring(1); // Remove the leading #
const paramsIndex2 = hashParamsString2.indexOf('?');

if (paramsIndex2 !== -1) {
const paramsString2 = hashParamsString2.substring(paramsIndex2 + 1);
const hashParams = new URLSearchParams(paramsString2);

if (hashParams && hashParams.has('m')) {
msgReg = hashParams.get('m');
}
}

let csrfToken;
function getBackendURL() {
const currentURL = window.location.href;
Expand Down Expand Up @@ -215,16 +229,13 @@ function translateKey(key) {
translation = translation[part];
} else {

//reject(new Error(`Translation for key '${key}' not found`));
return;
}
}



resolve(translation);
} else {

//reject(new Error(`Translations for language '${lang}' not found in the cache`));
return;
}
});
Expand Down Expand Up @@ -349,18 +360,8 @@ const handleLocation = async () => {
showTic1();
break;
case '#login':
const hashParamsString2 = window.location.hash.substring(1);
const paramsIndex2 = hashParamsString2.indexOf('?');
let msg = null;
if (paramsIndex2 !== -1) {
const paramsString = hashParamsString2.substring(paramsIndex + 1);
const hashParams = new URLSearchParams(paramsString);

if (hashParams && hashParams.has('msg')) {
msg = hashParams.get('msg');
}
}
await handleLogin(msg);

await handleLogin(msgReg);

break;
case '#tic2':
Expand Down

0 comments on commit 547f282

Please sign in to comment.