mirror of
https://github.com/docmost/docmost.git
synced 2026-05-16 14:14:06 +08:00
refactor: rename MFA enabled field to is_enabled
This commit is contained in:
@@ -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