From eb5197446429d833f45dac8169c114078a9ed990 Mon Sep 17 00:00:00 2001 From: GZTime Date: Sun, 11 Feb 2024 22:02:32 +0800 Subject: [PATCH] fix: remove `Model_PasswordTooShort` --- src/GZCTF/Controllers/AdminController.cs | 3 +-- src/GZCTF/Models/Request/Account/LoginModel.cs | 1 - src/GZCTF/Models/Request/Admin/UserCreateModel.cs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/GZCTF/Controllers/AdminController.cs b/src/GZCTF/Controllers/AdminController.cs index 83b1d4b62..aa438091c 100644 --- a/src/GZCTF/Controllers/AdminController.cs +++ b/src/GZCTF/Controllers/AdminController.cs @@ -146,8 +146,7 @@ public async Task AddUsers([FromBody] UserCreateModel[] model, Ca if (userInfo is null) { await trans.RollbackAsync(token); - return BadRequest(new RequestResponse(result.Errors.FirstOrDefault()?.Description ?? - localizer[nameof(Resources.Program.Identity_UnknownError)])); + return HandleIdentityError(result.Errors); } userInfo.UpdateUserInfo(user); diff --git a/src/GZCTF/Models/Request/Account/LoginModel.cs b/src/GZCTF/Models/Request/Account/LoginModel.cs index b45589d24..8f69f4d28 100644 --- a/src/GZCTF/Models/Request/Account/LoginModel.cs +++ b/src/GZCTF/Models/Request/Account/LoginModel.cs @@ -18,6 +18,5 @@ public class LoginModel : ModelWithCaptcha /// 密码 /// [Required] - [MinLength(6, ErrorMessageResourceName = nameof(Resources.Program.Model_PasswordTooShort))] public string Password { get; set; } = string.Empty; } diff --git a/src/GZCTF/Models/Request/Admin/UserCreateModel.cs b/src/GZCTF/Models/Request/Admin/UserCreateModel.cs index 4c75644bc..661596cf8 100644 --- a/src/GZCTF/Models/Request/Admin/UserCreateModel.cs +++ b/src/GZCTF/Models/Request/Admin/UserCreateModel.cs @@ -19,7 +19,6 @@ public class UserCreateModel /// 密码 /// [Required(ErrorMessageResourceName = nameof(Resources.Program.Model_PasswordRequired))] - [MinLength(6, ErrorMessageResourceName = nameof(Resources.Program.Model_PasswordTooShort))] public string Password { get; set; } = string.Empty; ///