perf: 将重置密码的日志挪到启动成功之后,方便查看

This commit is contained in:
xiaojunnuo
2026-02-02 11:46:55 +08:00
parent f48ef3d17b
commit 0fa9b344e0
2 changed files with 32 additions and 16 deletions
@@ -33,21 +33,6 @@ export class ResetPasswdMiddleware implements IWebMiddleware {
@Init()
async init() {
if (this.resetAdminPasswd === true) {
logger.info('开始重置1号管理员用户的密码');
const newPasswd = '123456';
await this.userService.resetPassword(1, newPasswd);
await this.userService.updateStatus(1, 1);
await this.userSettingsService.deleteWhere({
userId: 1,
key:"user.two.factor"
})
const publicSettings = await this.sysSettingsService.getPublicSettings()
publicSettings.captchaEnabled = false
await this.sysSettingsService.savePublicSettings(publicSettings);
const user = await this.userService.info(1);
logger.info(`重置1号管理员用户的密码完成,2FA设置已删除,验证码登录已禁用,用户名:${user.username},新密码:${newPasswd},请在登录进去之后尽快修改密码`);
}
}
}