refactor: rename MFA enabled field to is_enabled

This commit is contained in:
Philipinho
2025-07-23 20:46:48 -07:00
parent 2857d86dae
commit d789ba3ffa
7 changed files with 11 additions and 13 deletions
@@ -25,7 +25,7 @@ export function MfaSettings() {
}
// Check if MFA is truly enabled
const isMfaEnabled = mfaStatus?.enabled === true;
const isMfaEnabled = mfaStatus?.isEnabled === true;
const handleSetupComplete = () => {
setSetupModalOpen(false);
+3 -3
View File
@@ -1,10 +1,10 @@
export interface MfaMethod {
type: 'totp' | 'email';
enabled: boolean;
isEnabled: boolean;
}
export interface MfaSettings {
enabled: boolean;
isEnabled: boolean;
methods: MfaMethod[];
backupCodesCount: number;
lastUpdated?: string;
@@ -19,7 +19,7 @@ export interface MfaSetupState {
}
export interface MfaStatusResponse {
enabled?: boolean;
isEnabled?: boolean;
method?: string | null;
backupCodesCount?: number;
}
@@ -207,7 +207,7 @@ export class AuthService {
});
// Check if user has MFA enabled or workspace enforces MFA
const userHasMfa = user?.['mfa']?.enabled || false;
const userHasMfa = user?.['mfa']?.isEnabled || false;
const workspaceEnforcesMfa = workspace.enforceMfa || false;
if (userHasMfa || workspaceEnforcesMfa) {
@@ -9,11 +9,9 @@ export async function up(db: Kysely<any>): Promise<void> {
.addColumn('user_id', 'uuid', (col) =>
col.references('users.id').onDelete('cascade').notNull(),
)
.addColumn('method', 'varchar(50)', (col) =>
col.notNull().defaultTo('totp'),
)
.addColumn('secret', 'varchar(255)', (col) => col)
.addColumn('enabled', 'boolean', (col) => col.defaultTo(false))
.addColumn('method', 'varchar', (col) => col.notNull().defaultTo('totp'))
.addColumn('secret', 'text', (col) => col)
.addColumn('is_enabled', 'boolean', (col) => col.defaultTo(false))
.addColumn('backup_codes', sql`text[]`, (col) => col)
.addColumn('workspace_id', 'uuid', (col) =>
col.references('workspaces.id').onDelete('cascade').notNull(),
@@ -190,7 +190,7 @@ export class UserRepo {
.select([
'userMfa.id',
'userMfa.method',
'userMfa.enabled',
'userMfa.isEnabled',
'userMfa.createdAt',
])
.whereRef('userMfa.userId', '=', 'users.id'),
+1 -1
View File
@@ -250,8 +250,8 @@ export interface Spaces {
export interface UserMfa {
backupCodes: string[] | null;
createdAt: Generated<Timestamp>;
enabled: Generated<boolean | null>;
id: Generated<string>;
isEnabled: Generated<boolean | null>;
method: Generated<string>;
secret: string | null;
updatedAt: Generated<Timestamp>;