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
|
// Check if MFA is truly enabled
|
||||||
const isMfaEnabled = mfaStatus?.enabled === true;
|
const isMfaEnabled = mfaStatus?.isEnabled === true;
|
||||||
|
|
||||||
const handleSetupComplete = () => {
|
const handleSetupComplete = () => {
|
||||||
setSetupModalOpen(false);
|
setSetupModalOpen(false);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
export interface MfaMethod {
|
export interface MfaMethod {
|
||||||
type: 'totp' | 'email';
|
type: 'totp' | 'email';
|
||||||
enabled: boolean;
|
isEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MfaSettings {
|
export interface MfaSettings {
|
||||||
enabled: boolean;
|
isEnabled: boolean;
|
||||||
methods: MfaMethod[];
|
methods: MfaMethod[];
|
||||||
backupCodesCount: number;
|
backupCodesCount: number;
|
||||||
lastUpdated?: string;
|
lastUpdated?: string;
|
||||||
@@ -19,7 +19,7 @@ export interface MfaSetupState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface MfaStatusResponse {
|
export interface MfaStatusResponse {
|
||||||
enabled?: boolean;
|
isEnabled?: boolean;
|
||||||
method?: string | null;
|
method?: string | null;
|
||||||
backupCodesCount?: number;
|
backupCodesCount?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ export class AuthService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Check if user has MFA enabled or workspace enforces MFA
|
// 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;
|
const workspaceEnforcesMfa = workspace.enforceMfa || false;
|
||||||
|
|
||||||
if (userHasMfa || workspaceEnforcesMfa) {
|
if (userHasMfa || workspaceEnforcesMfa) {
|
||||||
|
|||||||
@@ -9,11 +9,9 @@ export async function up(db: Kysely<any>): Promise<void> {
|
|||||||
.addColumn('user_id', 'uuid', (col) =>
|
.addColumn('user_id', 'uuid', (col) =>
|
||||||
col.references('users.id').onDelete('cascade').notNull(),
|
col.references('users.id').onDelete('cascade').notNull(),
|
||||||
)
|
)
|
||||||
.addColumn('method', 'varchar(50)', (col) =>
|
.addColumn('method', 'varchar', (col) => col.notNull().defaultTo('totp'))
|
||||||
col.notNull().defaultTo('totp'),
|
.addColumn('secret', 'text', (col) => col)
|
||||||
)
|
.addColumn('is_enabled', 'boolean', (col) => col.defaultTo(false))
|
||||||
.addColumn('secret', 'varchar(255)', (col) => col)
|
|
||||||
.addColumn('enabled', 'boolean', (col) => col.defaultTo(false))
|
|
||||||
.addColumn('backup_codes', sql`text[]`, (col) => col)
|
.addColumn('backup_codes', sql`text[]`, (col) => col)
|
||||||
.addColumn('workspace_id', 'uuid', (col) =>
|
.addColumn('workspace_id', 'uuid', (col) =>
|
||||||
col.references('workspaces.id').onDelete('cascade').notNull(),
|
col.references('workspaces.id').onDelete('cascade').notNull(),
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ export class UserRepo {
|
|||||||
.select([
|
.select([
|
||||||
'userMfa.id',
|
'userMfa.id',
|
||||||
'userMfa.method',
|
'userMfa.method',
|
||||||
'userMfa.enabled',
|
'userMfa.isEnabled',
|
||||||
'userMfa.createdAt',
|
'userMfa.createdAt',
|
||||||
])
|
])
|
||||||
.whereRef('userMfa.userId', '=', 'users.id'),
|
.whereRef('userMfa.userId', '=', 'users.id'),
|
||||||
|
|||||||
+1
-1
@@ -250,8 +250,8 @@ export interface Spaces {
|
|||||||
export interface UserMfa {
|
export interface UserMfa {
|
||||||
backupCodes: string[] | null;
|
backupCodes: string[] | null;
|
||||||
createdAt: Generated<Timestamp>;
|
createdAt: Generated<Timestamp>;
|
||||||
enabled: Generated<boolean | null>;
|
|
||||||
id: Generated<string>;
|
id: Generated<string>;
|
||||||
|
isEnabled: Generated<boolean | null>;
|
||||||
method: Generated<string>;
|
method: Generated<string>;
|
||||||
secret: string | null;
|
secret: string | null;
|
||||||
updatedAt: Generated<Timestamp>;
|
updatedAt: Generated<Timestamp>;
|
||||||
|
|||||||
+1
-1
Submodule apps/server/src/ee updated: f60ab13698...c889c88001
Reference in New Issue
Block a user