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

This commit is contained in:
xiaojunnuo
2025-04-28 16:57:30 +08:00
parent afd59e9933
commit e3930e0717
3 changed files with 7 additions and 2 deletions
@@ -176,7 +176,11 @@ export class LoginService {
}
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) {
@@ -135,7 +135,7 @@ export class UserService extends BaseService<UserEntity> {
return bcrypt.hashSync(plainPassword, salt);
}
async findOne(param: any) {
async findOne(param: Record<string,any>) {
return this.repository.findOne({
where: param,
});