mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
refactor: rename MFA enabled field to is_enabled
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
@@ -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>;
|
||||
|
||||
+1
-1
Submodule apps/server/src/ee updated: f60ab13698...c889c88001
Reference in New Issue
Block a user