mirror of
https://github.com/certd/certd.git
synced 2026-04-28 07:57:25 +08:00
chore: 用户名注册不能为保留字
This commit is contained in:
@@ -44,6 +44,12 @@ export class RegisterController extends BaseController {
|
|||||||
if (sysPublicSettings.usernameRegisterEnabled === false) {
|
if (sysPublicSettings.usernameRegisterEnabled === false) {
|
||||||
throw new Error('当前站点已禁止用户名注册功能');
|
throw new Error('当前站点已禁止用户名注册功能');
|
||||||
}
|
}
|
||||||
|
if (!body.username) {
|
||||||
|
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user