Merge pull request #4565 from Infisical/feat/ENG-3660

Improve 2FA flow
This commit is contained in:
carlosmonastyrski
2025-09-23 20:25:12 -03:00
committed by GitHub
11 changed files with 461 additions and 157 deletions
@@ -117,12 +117,28 @@ export const SelectOrganizationSection = () => {
}
}
const { token, isMfaEnabled, mfaMethod } = await selectOrg
.mutateAsync({
let token;
let isMfaEnabled;
let mfaMethod;
try {
const result = await selectOrg.mutateAsync({
organizationId: organization.id,
userAgent: callbackPort ? UserAgentType.CLI : undefined
})
.finally(() => setIsInitialOrgCheckLoading(false));
});
token = result.token;
isMfaEnabled = result.isMfaEnabled;
mfaMethod = result.mfaMethod;
} catch (error: any) {
setIsInitialOrgCheckLoading(false);
if (error?.response?.status === 403) {
await handleLogout();
return;
}
throw error;
} finally {
setIsInitialOrgCheckLoading(false);
}
await router.invalidate();