调整用户名长度4~32,昵称1~30

This commit is contained in:
2025-05-12 13:56:20 +08:00
parent 26142f9a71
commit 054d505117
3 changed files with 13 additions and 9 deletions

View File

@@ -1,8 +1,10 @@
import { IsString, Length, Matches } from "class-validator";
export class UpdatePasswordDto {
@IsString()
@Length(6, 32)
@Matches(/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d!@#$%^&*()_+\-=\[\]{};:'",.<>/?]{6,32}$/)
@IsString({ message: '密码不得为空' })
@Length(6, 32, { message: '密码长度只能为6~32' })
@Matches(/^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d!@#$%^&*()_+\-=\[\]{};:'",.<>/?]{6,32}$/,
{ message: '密码必须包含字母和数字且长度在6~32之间' }
)
password: string;
}