Add MFA Flow also to Super Admin (#186)
* Add MFA flow to Super Admin checks
This commit is contained in:
committed by
GitHub
parent
e9f323e5f2
commit
68c6d51d33
@@ -115,6 +115,18 @@ async function adminMiddleware(request: NextRequest, response: NextResponse) {
|
||||
);
|
||||
}
|
||||
|
||||
const supabase = createMiddlewareClient(request, response);
|
||||
|
||||
const requiresMultiFactorAuthentication =
|
||||
await checkRequiresMultiFactorAuthentication(supabase);
|
||||
|
||||
// If user requires multi-factor authentication, redirect to MFA page.
|
||||
if (requiresMultiFactorAuthentication) {
|
||||
return NextResponse.redirect(
|
||||
new URL(pathsConfig.auth.verifyMfa, origin).href,
|
||||
);
|
||||
}
|
||||
|
||||
const role = user?.app_metadata.role;
|
||||
|
||||
// If user is not an admin, redirect to 404 page.
|
||||
|
||||
Reference in New Issue
Block a user