chore: 用户名注册不能为保留字

v2
xiaojunnuo 2025-08-07 10:28:21 +08:00
parent b1b3e39fcd
commit 06d166d0d7
1 changed files with 6 additions and 0 deletions

View File

@ -44,6 +44,12 @@ export class RegisterController extends BaseController {
if (sysPublicSettings.usernameRegisterEnabled === false) {
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);
const newUser = await this.userService.register(body.type, {
username: body.username,