add providerAuthToken for MFA login

This commit is contained in:
Sheen Capadngan
2023-05-11 00:47:16 +08:00
parent a194e90644
commit 0ef5779776
3 changed files with 12 additions and 6 deletions

View File

@@ -52,10 +52,12 @@ interface VerifyMfaTokenError {
*/
export default function MFAStep({
email,
password
password,
providerAuthToken,
}: {
email: string;
password: string;
providerAuthToken?: string;
}): JSX.Element {
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
@@ -77,6 +79,7 @@ export default function MFAStep({
const isLoginSuccessful = await attemptLoginMfa({
email,
password,
providerAuthToken,
mfaToken: mfaCode
});
@@ -136,11 +139,10 @@ export default function MFAStep({
<div className="flex flex-row items-baseline gap-1 text-sm">
<span className="text-bunker-400">{t('mfa.step2-resend-alert')}</span>
<u
className={`font-normal ${
isLoadingResend
? 'text-bunker-400'
: 'text-primary-700 duration-200 hover:text-primary'
}`}
className={`font-normal ${isLoadingResend
? 'text-bunker-400'
: 'text-primary-700 duration-200 hover:text-primary'
}`}
>
<button disabled={isLoading} onClick={() => handleResendMfaCode()} type="button">
{isLoadingResend ? t('mfa.step2-resend-progress') : t('mfa.step2-resend-submit')}

View File

@@ -23,10 +23,12 @@ const client = new jsrp.client();
const attemptLoginMfa = async ({
email,
password,
providerAuthToken,
mfaToken
}: {
email: string;
password: string;
providerAuthToken?: string,
mfaToken: string;
}): Promise<Boolean> => {
return new Promise((resolve, reject) => {
@@ -39,6 +41,7 @@ const attemptLoginMfa = async ({
const { salt } = await login1({
email,
clientPublicKey,
providerAuthToken,
});
const {

View File

@@ -91,6 +91,7 @@ export default function Login() {
<MFAStep
email={email || providerEmail}
password={password}
providerAuthToken={providerAuthToken}
/>
}