mirror of https://github.com/certd/certd
perf: 注册时支持填写用户名
parent
06d166d0d7
commit
fdcfcc77a0
|
@ -32,6 +32,13 @@
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="email" tab="邮箱注册" :disabled="!settingsStore.sysPublic.emailRegisterEnabled">
|
<a-tab-pane key="email" tab="邮箱注册" :disabled="!settingsStore.sysPublic.emailRegisterEnabled">
|
||||||
<template v-if="registerType === 'email'">
|
<template v-if="registerType === 'email'">
|
||||||
|
<a-form-item required has-feedback name="username" label="用户名">
|
||||||
|
<a-input v-model:value="formState.username" placeholder="用户名" size="large" autocomplete="off">
|
||||||
|
<template #prefix>
|
||||||
|
<fs-icon icon="ion:person-outline"></fs-icon>
|
||||||
|
</template>
|
||||||
|
</a-input>
|
||||||
|
</a-form-item>
|
||||||
<a-form-item required has-feedback name="email" label="邮箱">
|
<a-form-item required has-feedback name="email" label="邮箱">
|
||||||
<a-input v-model:value="formState.email" placeholder="邮箱" size="large" autocomplete="off">
|
<a-input v-model:value="formState.email" placeholder="邮箱" size="large" autocomplete="off">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
|
|
|
@ -40,6 +40,10 @@ export class RegisterController extends BaseController {
|
||||||
throw new Error('当前站点已禁止自助注册功能');
|
throw new Error('当前站点已禁止自助注册功能');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!body.username && body.username in ["admin","certd"]) {
|
||||||
|
throw new Error('用户名不能为保留字');
|
||||||
|
}
|
||||||
|
|
||||||
if (body.type === 'username') {
|
if (body.type === 'username') {
|
||||||
if (sysPublicSettings.usernameRegisterEnabled === false) {
|
if (sysPublicSettings.usernameRegisterEnabled === false) {
|
||||||
throw new Error('当前站点已禁止用户名注册功能');
|
throw new Error('当前站点已禁止用户名注册功能');
|
||||||
|
@ -47,9 +51,7 @@ export class RegisterController extends BaseController {
|
||||||
if (!body.username) {
|
if (!body.username) {
|
||||||
throw new Error('用户名不能为空');
|
throw new Error('用户名不能为空');
|
||||||
}
|
}
|
||||||
if (body.username in ["admin","certd"]) {
|
|
||||||
throw new Error('用户名不能为保留字');
|
|
||||||
}
|
|
||||||
await this.codeService.checkCaptcha(body.randomStr, body.imgCode);
|
await this.codeService.checkCaptcha(body.randomStr, body.imgCode);
|
||||||
const newUser = await this.userService.register(body.type, {
|
const newUser = await this.userService.register(body.type, {
|
||||||
username: body.username,
|
username: body.username,
|
||||||
|
@ -70,6 +72,7 @@ export class RegisterController extends BaseController {
|
||||||
throwError: true,
|
throwError: true,
|
||||||
});
|
});
|
||||||
const newUser = await this.userService.register(body.type, {
|
const newUser = await this.userService.register(body.type, {
|
||||||
|
username: body.username,
|
||||||
phoneCode: body.phoneCode,
|
phoneCode: body.phoneCode,
|
||||||
mobile: body.mobile,
|
mobile: body.mobile,
|
||||||
password: body.password,
|
password: body.password,
|
||||||
|
|
Loading…
Reference in New Issue