update
This commit is contained in:
@@ -61,13 +61,6 @@ type LoginMFAResquest struct {
|
||||
TOTPCode string `json:"totp_code" binding:"required"`
|
||||
}
|
||||
|
||||
// RegisterRequest is the JSON body for register endpoint.
|
||||
type RegisterRequest struct {
|
||||
Name string `json:"name" binding:"required,min=2"`
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Password string `json:"password" binding:"required,min=6"`
|
||||
}
|
||||
|
||||
// RefreshRequest is the JSON body for refresh endpoint.
|
||||
type RefreshRequest struct {
|
||||
RefreshToken string `json:"refresh_token" binding:"required"`
|
||||
@@ -251,31 +244,6 @@ func (h *AuthHandler) LoginMFA(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// Register creates a new user account.
|
||||
// POST /api/v1/auth/register
|
||||
func (h *AuthHandler) Register(c *gin.Context) {
|
||||
var req RegisterRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrValidation, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
user, err := h.authService.Register(c.Request.Context(), &service.RegisterInput{
|
||||
Name: req.Name,
|
||||
Email: req.Email,
|
||||
Password: req.Password,
|
||||
})
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusConflict, response.ErrConflict, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
response.Created(c, gin.H{
|
||||
"user": user,
|
||||
"message": "Registration successful. Please verify your email.",
|
||||
})
|
||||
}
|
||||
|
||||
// Refresh rotates a refresh token and returns new JWT pair.
|
||||
// POST /api/v1/auth/refresh
|
||||
// Implements refresh token rotation per P2E §1.4 security requirement.
|
||||
@@ -521,7 +489,6 @@ func RegisterAuthRoutes(rg *gin.RouterGroup, handler *AuthHandler) {
|
||||
// Core auth endpoints
|
||||
authGroup.POST("/login", handler.Login)
|
||||
authGroup.POST("/login/mfa", handler.LoginMFA)
|
||||
authGroup.POST("/register", handler.Register)
|
||||
authGroup.POST("/refresh", handler.Refresh)
|
||||
authGroup.DELETE("/logout", handler.Logout)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user