mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
feat: 手机号登录、邮箱验证码注册
This commit is contained in:
@@ -12,7 +12,7 @@ export type RegisterReq = {
|
||||
phoneCode?: string;
|
||||
|
||||
validateCode: string;
|
||||
imageCode: string;
|
||||
imgCode: string;
|
||||
randomStr: string;
|
||||
};
|
||||
|
||||
@@ -40,16 +40,17 @@ export class RegisterController extends BaseController {
|
||||
}
|
||||
|
||||
if (body.type === 'username') {
|
||||
if (sysPublicSettings.usernameRegisterEnabled) {
|
||||
if (sysPublicSettings.usernameRegisterEnabled === false) {
|
||||
throw new Error('当前站点已禁止用户名注册功能');
|
||||
}
|
||||
await this.codeService.checkCaptcha(body.randomStr, body.imgCode);
|
||||
const newUser = await this.userService.register(body.type, {
|
||||
username: body.username,
|
||||
password: body.password,
|
||||
} as any);
|
||||
return this.ok(newUser);
|
||||
} else if (body.type === 'mobile') {
|
||||
if (sysPublicSettings.mobileRegisterEnabled) {
|
||||
if (sysPublicSettings.mobileRegisterEnabled === false) {
|
||||
throw new Error('当前站点已禁止手机号注册功能');
|
||||
}
|
||||
//验证短信验证码
|
||||
|
||||
Reference in New Issue
Block a user