mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-06 23:19:47 +00:00
Fix missing config usage for backup codes
This commit is contained in:
@@ -20,6 +20,7 @@ import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import crypto from "crypto";
|
||||
import { Config } from "../util";
|
||||
|
||||
@Entity({
|
||||
name: "backup_codes",
|
||||
@@ -41,7 +42,7 @@ export class BackupCode extends BaseClass {
|
||||
|
||||
export function generateMfaBackupCodes(user_id: string) {
|
||||
const backup_codes: BackupCode[] = [];
|
||||
for (let i = 0; i < 10; i++) {
|
||||
for (let i = 0; i < Config.get().security.mfaBackupCodeCount; i++) {
|
||||
const code = BackupCode.create({
|
||||
user: { id: user_id },
|
||||
code: crypto.randomBytes(4).toString("hex"), // 8 characters
|
||||
|
||||
Reference in New Issue
Block a user