feat: 邮箱校验属性变更

feat/uniplus
moonrailgun 2 years ago
parent e78f10a69c
commit ce97957fa9

@ -106,7 +106,7 @@ export class User extends TimeStamps implements Base {
@prop({
default: false,
})
emailAvailable: boolean;
emailVerified: boolean;
/**
*

@ -336,6 +336,7 @@ class UserService extends TcService {
nickname
);
let emailVerified = false;
if (config.emailVerification === true) {
// 检查OTP
const cacheKey = this.buildVerifyEmailKey(params.email);
@ -344,6 +345,8 @@ class UserService extends TcService {
if (String(cachedOtp) !== params.emailOTP) {
throw new Error(t('邮箱校验失败, 请输入正确的邮箱OTP'));
}
emailVerified = true;
}
const password = await this.hashPassword(params.password);
@ -352,6 +355,7 @@ class UserService extends TcService {
password,
nickname,
discriminator,
emailVerified,
avatar: null,
createdAt: new Date(),
});
@ -449,6 +453,8 @@ class UserService extends TcService {
if (String(cachedOtp) !== params.emailOTP) {
throw new Error(t('邮箱校验失败, 请输入正确的邮箱OTP'));
}
user.emailVerified = true;
}
await this.validateRegisterParams(params, t);

Loading…
Cancel
Save