feat: Implement a comprehensive two-factor authentication system including setup, verification, backup codes, and integration into the login flow.
This commit is contained in:
@@ -35,6 +35,17 @@ export default function LoginPage() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if 2FA is required (response is wrapped in { success, data })
|
||||
if (validateData.data?.requiresTwoFactor) {
|
||||
// Redirect to 2FA verification page with tempToken
|
||||
const params = new URLSearchParams({
|
||||
token: validateData.data.tempToken,
|
||||
email: email,
|
||||
});
|
||||
router.push(`/login/verify-2fa?${params.toString()}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// If validation passed, use NextAuth to create session
|
||||
const result = await signIn('credentials', {
|
||||
email,
|
||||
|
||||
Reference in New Issue
Block a user