diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Auth/Register.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Auth/Register.razor index 4f9d409a..f7ac6945 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Auth/Register.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Auth/Register.razor @@ -22,14 +22,25 @@ -
- - - +
+
+ + + +
+
+ + + +
diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/AuthService.cs b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/AuthService.cs index 86a9a245..6080ef00 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/AuthService.cs +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/AuthService.cs @@ -50,19 +50,22 @@ public class AuthService { try { - // EN: Build payload with FirstName/LastName from DisplayName (IAM requires these) - // VI: Tạo payload với FirstName/LastName từ DisplayName (IAM yêu cầu) - var parts = (dto.DisplayName ?? "User").Trim().Split(' ', 2); + // EN: Build payload with FirstName/LastName from form (IAM requires these) + // VI: Tạo payload với FirstName/LastName từ form (IAM yêu cầu) var payload = new { dto.Email, dto.Password, - FirstName = parts[0], - LastName = parts.Length > 1 ? parts[1] : parts[0], - DisplayName = dto.DisplayName + dto.FirstName, + dto.LastName }; - var response = await _http.PostAsJsonAsync("/api/auth/register", payload); + // EN: Use PascalCase serialization to match backend RegisterUserCommand record params + // VI: Dùng PascalCase serialization để khớp với record params backend + var jsonOptions = new JsonSerializerOptions { PropertyNamingPolicy = null }; + var jsonContent = JsonContent.Create(payload, options: jsonOptions); + + var response = await _http.PostAsync("/api/auth/register", jsonContent); if (response.IsSuccessStatusCode) { return (true, null); diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/css/app.css b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/css/app.css index 00325b52..2764a4fe 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/css/app.css +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/css/app.css @@ -1020,6 +1020,22 @@ a { } /* Form Components */ +.form-row { + display: flex; + gap: var(--space-4); +} + +.form-row>.form-group { + flex: 1; +} + +@media (max-width: 480px) { + .form-row { + flex-direction: column; + gap: 0; + } +} + .form-group { margin-bottom: var(--space-6); } diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/en-US.json b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/en-US.json index cb83d390..0c0a8aeb 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/en-US.json +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/en-US.json @@ -297,7 +297,8 @@ "Auth_Login_Error": "Invalid email or password", "Auth_Login_RegisterLink": "Register now", "Auth_Login_Success": "Welcome {0}! Redirecting...", - "Auth_Register_DisplayName": "Display name", + "Auth_Register_FirstName": "First name", + "Auth_Register_LastName": "Last name", "Auth_Register_Error": "Registration failed", "Auth_Register_HaveAccount": "Already have an account?", "Auth_Register_LoginLink": "Sign In", diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/vi-VN.json b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/vi-VN.json index 0ebdff28..5652824b 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/vi-VN.json +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/wwwroot/locales/vi-VN.json @@ -297,7 +297,8 @@ "Auth_Login_Error": "Email hoặc mật khẩu không đúng", "Auth_Login_RegisterLink": "Đăng ký ngay", "Auth_Login_Success": "Chào mừng {0}! Đang chuyển hướng...", - "Auth_Register_DisplayName": "Tên hiển thị", + "Auth_Register_FirstName": "Tên", + "Auth_Register_LastName": "Họ", "Auth_Register_Error": "Đăng ký thất bại", "Auth_Register_HaveAccount": "Đã có tài khoản?", "Auth_Register_LoginLink": "Đăng nhập", diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Shared/DTOs/UserDto.cs b/apps/web-client-tpos-net/src/WebClientTpos.Shared/DTOs/UserDto.cs index 20ddcfb5..3b97d96f 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Shared/DTOs/UserDto.cs +++ b/apps/web-client-tpos-net/src/WebClientTpos.Shared/DTOs/UserDto.cs @@ -35,12 +35,20 @@ public class RegisterDto public string ConfirmPassword { get; set; } = string.Empty; /// - /// EN: User display name. - /// VI: Tên hiển thị của user. + /// EN: User first name. + /// VI: Tên của user. /// - [Required(ErrorMessage = "Tên là bắt buộc / Name is required")] - [StringLength(50, MinimumLength = 2, ErrorMessage = "Tên phải từ 2-50 ký tự / Name must be 2-50 chars")] - public string DisplayName { get; set; } = string.Empty; + [Required(ErrorMessage = "Tên là bắt buộc / First name is required")] + [StringLength(50, MinimumLength = 1, ErrorMessage = "Tên phải từ 1-50 ký tự / First name must be 1-50 chars")] + public string FirstName { get; set; } = string.Empty; + + /// + /// EN: User last name. + /// VI: Họ của user. + /// + [Required(ErrorMessage = "Họ là bắt buộc / Last name is required")] + [StringLength(50, MinimumLength = 1, ErrorMessage = "Họ phải từ 1-50 ký tự / Last name must be 1-50 chars")] + public string LastName { get; set; } = string.Empty; /// /// EN: Accept terms of service.