fix: improve auth error messages and unify username validation length
This commit is contained in:
@@ -87,7 +87,7 @@ func (h *AuthHandler) Register(c *gin.Context) {
|
||||
user, err := h.userService.Register(ctx, &req)
|
||||
if err != nil {
|
||||
logger.Errorf(ctx, "Failed to register user: %v", err)
|
||||
appErr := errors.NewBadRequestError("Registration failed").WithDetails(err.Error())
|
||||
appErr := errors.NewBadRequestError(err.Error())
|
||||
c.Error(appErr)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ type LoginRequest struct {
|
||||
|
||||
// RegisterRequest represents a registration request
|
||||
type RegisterRequest struct {
|
||||
Username string `json:"username" binding:"required,min=3,max=50"`
|
||||
Username string `json:"username" binding:"required,min=2,max=50"`
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Password string `json:"password" binding:"required,min=6"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user