mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 13:29:12 +00:00
Add more edge-cases to MFA
This commit is contained in:
@@ -63,7 +63,6 @@ export default function LoginStep ({
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
setLoginError(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,18 @@ const props = {
|
||||
}
|
||||
} as const;
|
||||
|
||||
interface VerifyMfaTokenError {
|
||||
response: {
|
||||
data: {
|
||||
context: {
|
||||
code: string;
|
||||
triesLeft: number;
|
||||
}
|
||||
},
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 2nd step of login - users enter their MFA code
|
||||
* @param {Object} obj
|
||||
@@ -73,7 +85,15 @@ export default function MFAStep({
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
const error = err as VerifyMfaTokenError;
|
||||
|
||||
if (error?.response?.status === 500) {
|
||||
window.location.reload();
|
||||
} else if (error?.response?.data?.context?.triesLeft === 0) {
|
||||
window.location.reload();
|
||||
router.push('/login');
|
||||
}
|
||||
|
||||
setIsLoading(false);
|
||||
setCodeError(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user