fix: 修复二次认证登录进入错误账号的bug

pull/409/head
xiaojunnuo 2025-04-28 16:57:30 +08:00
parent afd59e9933
commit e3930e0717
3 changed files with 7 additions and 2 deletions

View File

@ -127,6 +127,7 @@ const doAuthenticatorSave = async (form: any) => {
message: "保存成功", message: "保存成功",
}); });
authenticatorForm.open = false; authenticatorForm.open = false;
formState.authenticator.verified = true;
}; };
function onAuthenticatorEnabledChanged(value: any) { function onAuthenticatorEnabledChanged(value: any) {

View File

@ -176,7 +176,11 @@ export class LoginService {
} }
await this.twoFactorService.verifyAuthenticatorCode(userId, req.verifyCode) await this.twoFactorService.verifyAuthenticatorCode(userId, req.verifyCode)
return this.generateToken(await this.userService.findOne(userId)) const user = await this.userService.info(userId);
if (!user) {
throw new AuthException('用户不存在')
}
return this.generateToken(user)
} }
private async onLoginSuccess(info: UserEntity) { private async onLoginSuccess(info: UserEntity) {

View File

@ -135,7 +135,7 @@ export class UserService extends BaseService<UserEntity> {
return bcrypt.hashSync(plainPassword, salt); return bcrypt.hashSync(plainPassword, salt);
} }
async findOne(param: any) { async findOne(param: Record<string,any>) {
return this.repository.findOne({ return this.repository.findOne({
where: param, where: param,
}); });