mirror of https://github.com/certd/certd
fix: 修复二次认证登录进入错误账号的bug
parent
afd59e9933
commit
e3930e0717
|
@ -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) {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue