mirror of https://github.com/certd/certd
				
				
				
			chore: 用户名注册不能为保留字
							parent
							
								
									b1b3e39fcd
								
							
						
					
					
						commit
						06d166d0d7
					
				| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue