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,
|
roleId: user.role_id,
|
||||||
roleName: user.roles?.name ?? null,
|
roleName: user.roles?.name ?? null,
|
||||||
permissions,
|
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;
|
roleId: number | null;
|
||||||
roleName: string | null;
|
roleName: string | null;
|
||||||
permissions: string[];
|
permissions: string[];
|
||||||
|
totp_enabled?: boolean;
|
||||||
|
require_2fa?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JwtPayload {
|
export interface JwtPayload {
|
||||||
|
|||||||
Reference in New Issue
Block a user