Honor email mfa setting

This commit is contained in:
Neeraj Gupta 2023-08-02 17:37:54 +05:30
parent 87e8165346
commit 6f36515a3a
3 changed files with 6 additions and 4 deletions

View file

@ -28,12 +28,11 @@ export default function Login(props: LoginProps) {
addLocalLog(
() => ` srpAttributes: ${JSON.stringify(srpAttributes)}`
);
if (!srpAttributes) {
setUserSRPSetupPending(true);
setUserSRPSetupPending(!srpAttributes);
if (!srpAttributes || srpAttributes.isEmailMFAEnabled) {
await sendOtt(email);
router.push(PAGES.VERIFY);
} else {
setUserSRPSetupPending(false);
setData(LS_KEYS.SRP_ATTRIBUTES, srpAttributes);
router.push(PAGES.CREDENTIALS);
}

View file

@ -531,7 +531,9 @@ export async function getDisableCFUploadProxyFlag(): Promise<boolean> {
}
}
export const getSRPAttributes = async (email: string) => {
export const getSRPAttributes = async (
email: string
): Promise<SRPAttributes | null> => {
try {
const resp = await HTTPService.get(`${ENDPOINT}/users/srp/attributes`, {
email,

View file

@ -122,6 +122,7 @@ export interface SRPAttributes {
memLimit: number;
opsLimit: number;
kekSalt: string;
isEmailMFAEnabled: boolean;
}
export interface GetSRPAttributesResponse {