From 06d166d0d7f5b9731919ee8f5c57c2462d3256a9 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Thu, 7 Aug 2025 10:28:21 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=94=A8=E6=88=B7=E5=90=8D=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E4=B8=8D=E8=83=BD=E4=B8=BA=E4=BF=9D=E7=95=99=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/user/login/register-controller.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/ui/certd-server/src/controller/user/login/register-controller.ts b/packages/ui/certd-server/src/controller/user/login/register-controller.ts index c8d45c2d..7ad2bacf 100644 --- a/packages/ui/certd-server/src/controller/user/login/register-controller.ts +++ b/packages/ui/certd-server/src/controller/user/login/register-controller.ts @@ -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,