File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 77 "passwordTooShort" : " Password must be at least 8 characters long" ,
88 "passwordRequirements" : " Password must contain at least one letter and one number" ,
99 "emailAlreadyInUse" : " Email already in use" ,
10- "provideVerificationCode" : " Please provide verification code"
10+ "provideVerificationCode" : " Please provide verification code" ,
11+ "userCannotbeEmptyStr" : " Invalid username"
1112 }
1213}
Original file line number Diff line number Diff line change 77 "passwordTooShort" : " 密码长度至少为 8 个字符" ,
88 "passwordRequirements" : " 密码必须包含至少一个字母和一个数字" ,
99 "emailAlreadyInUse" : " 邮箱已被使用" ,
10- "provideVerificationCode" : " 请提供邮箱验证码"
10+ "provideVerificationCode" : " 请提供邮箱验证码" ,
11+ "userCannotbeEmptyStr" : " 无效的用户名"
1112 }
1213}
Original file line number Diff line number Diff line change @@ -338,6 +338,14 @@ export class UserService {
338338 }
339339
340340 async update ( id : string , account : UpdateUserDto ) {
341+ if ( account . username && ! account . username . trim ( ) . length ) {
342+ const message = this . i18n . t ( 'user.errors.userCannotbeEmptyStr' ) ;
343+ throw new AppException (
344+ message ,
345+ 'USERNAME_CANNOT_BE_EMPTY' ,
346+ HttpStatus . BAD_REQUEST ,
347+ ) ;
348+ }
341349 if ( account . username && isUsernameBlocked ( account . username ) ) {
342350 const message = this . i18n . t ( 'user.errors.accountAlreadyExists' ) ;
343351 throw new AppException (
You can’t perform that action at this time.
0 commit comments