Implement MFA Enforcement

This commit is contained in:
gpt-engineer-app[bot]
2025-10-14 13:45:59 +00:00
parent 121f7c533a
commit 7aa219efe5
10 changed files with 216 additions and 12 deletions

View File

@@ -0,0 +1,21 @@
import { useAuth } from './useAuth';
import { useUserRole } from './useUserRole';
export function useRequireMFA() {
const { aal } = useAuth();
const { isModerator, isAdmin, loading } = useUserRole();
// MFA is required for moderators and admins
const requiresMFA = isModerator() || isAdmin();
// User has MFA if they have AAL2
const hasMFA = aal === 'aal2';
return {
requiresMFA,
hasMFA,
needsEnrollment: requiresMFA && !hasMFA,
aal,
loading,
};
}