2fa: fix hash parsing in router

This commit is contained in:
Girish Ramakrishnan
2025-12-01 19:54:19 +01:00
parent e209bdec65
commit 11f9e260ed

View File

@@ -131,7 +131,7 @@ function onToggleGroup(group) {
}
function onHashChange() {
const v = location.hash;
const v = window.location.hash.split('?')[0];
if (v === VIEWS.APPS) {
view.value = VIEWS.APPS;
@@ -268,7 +268,9 @@ onMounted(async () => {
avatarUrl.value = `https://${config.value.adminFqdn}/api/v1/cloudron/avatar`;
if (config.value.mandatory2FA && !profile.value.twoFactorAuthenticationEnabled) window.location.hash = `/${VIEWS.PROFILE}?setup2fa`;
if (config.value.mandatory2FA && !profile.value.twoFactorAuthenticationEnabled) {
window.location.hash = '/profile?setup2fa'; // VIEWS.PROFILE has a # in front
}
window.addEventListener('hashchange', onHashChange);
onHashChange();