Skip to content

Modern Docker Management, Designed for Everyone

fix: password change not being accepted by the backend

Kyle Mendelle82b11489acd
diff --git a/backend/internal/api/user_handler.go b/backend/internal/api/user_handler.go
index 740365454..7186e2263 100644
--- a/backend/internal/api/user_handler.go
+++ b/backend/internal/api/user_handler.go
@@ -210,6 +210,18 @@ func (h *UserHandler) UpdateUser(c *gin.Context) {
user.Locale = req.Locale
}
+ if req.Password != nil && *req.Password != "" {
+ hashedPassword, err := h.userService.HashPassword(*req.Password)
+ if err != nil {
+ c.JSON(http.StatusInternalServerError, gin.H{
+ "success": false,
+ "data": gin.H{"error": "Failed to hash password"},
+ })
+ return
+ }
+ user.PasswordHash = hashedPassword
+ }
+
now := time.Now()
user.UpdatedAt = &now
diff --git a/backend/internal/dto/user_dto.go b/backend/internal/dto/user_dto.go
index e05b5ad7c..f9d57dc3b 100644
--- a/backend/internal/dto/user_dto.go
+++ b/backend/internal/dto/user_dto.go
@@ -14,6 +14,7 @@ type UpdateUserDto struct {
Email *string `json:"email,omitempty"`
Roles []string `json:"roles,omitempty"`
Locale *string `json:"locale,omitempty"`
+ Password *string `json:"password,omitempty"`
}
type UserResponseDto struct {