feat(auth): 添加请求参数校验支持

- 在 AuthController 中为注册和登录接口添加 @Validated 注解
- 更新 DeviceController、RoleController 和 UserController 中的相关接口以支持参数校验
- 修改 AuthLoginRequest 中用户名校验的错误提示信息
This commit is contained in:
Chaos
2025-11-24 07:18:42 +08:00
parent 4f0e0c163d
commit ec49ea8e25
5 changed files with 14 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ import lombok.Data;
*/
@Data
public class AuthLoginRequest {
@Pattern(regexp = "^[a-zA-Z0-9_-]{5,16}$", message = "用户名需为5-16位字母、数字、_或-")
@Pattern(regexp = "^[a-zA-Z0-9_-]{5,16}$", message = "用户名校验失败")
private String username;
@Pattern(regexp = "^.{8,16}$", message = "密码长度需为8-16位")
private String password;