fix: dashboard TOTP status always showing inactive
loadAuthData() didn't include totp_enabled or require_2fa in the AuthData response. The frontend always saw undefined → false. Now includes both fields from the database. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,8 @@ async function loadAuthData(userId: number): Promise<AuthData | null> {
|
||||
roleId: user.role_id,
|
||||
roleName: user.roles?.name ?? null,
|
||||
permissions,
|
||||
totp_enabled: !!user.totp_enabled,
|
||||
require_2fa: !!(await prisma.company_settings.findFirst({ select: { require_2fa: true } }))?.require_2fa,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ export interface AuthData {
|
||||
roleId: number | null;
|
||||
roleName: string | null;
|
||||
permissions: string[];
|
||||
totp_enabled?: boolean;
|
||||
require_2fa?: boolean;
|
||||
}
|
||||
|
||||
export interface JwtPayload {
|
||||
|
||||
Reference in New Issue
Block a user