diff --git a/server/src/modules/auth/base/auth.service.ts b/server/src/modules/auth/base/auth.service.ts index 70497de5..0344388e 100644 --- a/server/src/modules/auth/base/auth.service.ts +++ b/server/src/modules/auth/base/auth.service.ts @@ -397,17 +397,17 @@ export class AuthService { ); } - if (userDto.username && !this.isUsernameAllowed(userDto.username)) { - throw new HttpException( - { - status: HttpStatus.UNPROCESSABLE_ENTITY, - errors: { - username: 'invalid', - }, - }, - HttpStatus.UNPROCESSABLE_ENTITY - ); - } + // if (userDto.username && !this.isUsernameAllowed(userDto.username)) { + // throw new HttpException( + // { + // status: HttpStatus.UNPROCESSABLE_ENTITY, + // errors: { + // username: 'invalid', + // }, + // }, + // HttpStatus.UNPROCESSABLE_ENTITY + // ); + // } await this.sessionService.softDelete({ user: { @@ -423,9 +423,9 @@ export class AuthService { }); } - private isUsernameAllowed(username: string) { - return /^[A-Za-z0-9]+$/.test(username); - } + // private isUsernameAllowed(username: string) { + // return /^[A-Za-z0-9]+$/.test(username); + // } async refreshToken( data: Pick diff --git a/server/src/modules/auth/base/dto/auth-update.dto.ts b/server/src/modules/auth/base/dto/auth-update.dto.ts index 606e3e2e..9ef13daa 100644 --- a/server/src/modules/auth/base/dto/auth-update.dto.ts +++ b/server/src/modules/auth/base/dto/auth-update.dto.ts @@ -1,5 +1,6 @@ import { ApiProperty } from '@nestjs/swagger'; import { + IsAlphanumeric, IsArray, IsIn, IsNotEmpty, @@ -43,6 +44,7 @@ export class AuthUpdateDto { @Validate(IsNotExist, ['User'], { message: 'usernameAlreadyExists', }) + @IsAlphanumeric() username?: string | null; @ApiProperty()