diff --git a/src/lib/components/admin/Settings/Authentication.svelte b/src/lib/components/admin/Settings/Authentication.svelte index 189cb55e81..0132e15b11 100644 --- a/src/lib/components/admin/Settings/Authentication.svelte +++ b/src/lib/components/admin/Settings/Authentication.svelte @@ -92,6 +92,11 @@ toast.error(`${error}`); return null; }); + if (res?.sessions_revoked) { + localStorage.removeItem('token'); + window.location.href = '/auth?state=logout&form=signin'; + return false; + } if (res) { adminConfig = res; } @@ -99,11 +104,13 @@ }; const submitHandler = async () => { - const adminSaved = await updateAdminHandler(); const ldapSaved = await updateLdapServerHandler(); const oauthSaved = await updateOAuthHandler(); + if (!ldapSaved || !oauthSaved) return; - if (adminSaved && ldapSaved && oauthSaved) { + // Save MFA policy last because changing it revokes the current session. + const adminSaved = await updateAdminHandler(); + if (adminSaved) { toast.success($i18n.t('Settings saved successfully!')); await config.set(await getBackendConfig()); } @@ -255,6 +262,32 @@ + + + + +

+ {$i18n.t('Changes sign out all devices. Users enroll on their next sign-in.')} +

+ {#if adminConfig.ENABLE_MFA} + + + {/if} +
+ diff --git a/src/lib/components/admin/Settings/General.svelte b/src/lib/components/admin/Settings/General.svelte index 570d834e8c..3e269aa9e5 100644 --- a/src/lib/components/admin/Settings/General.svelte +++ b/src/lib/components/admin/Settings/General.svelte @@ -275,31 +275,7 @@ {/if} - - - - -

- {$i18n.t('Changes sign out all devices. Users enroll on their next sign-in.')} -

- {#if adminConfig.ENABLE_MFA} - - - {/if} -
+ {:else}
-

+

{$i18n.t( challenge.next_step === 'enroll' ? 'Set up your authenticator' @@ -103,7 +103,7 @@ />
{$i18n.t('Enter the key manually')} @@ -118,11 +118,11 @@

{:else}{/if} {/if} -