diff --git a/controller/user.go b/controller/user.go index b68a4c1..8947225 100644 --- a/controller/user.go +++ b/controller/user.go @@ -295,6 +295,9 @@ func UpdateUser(c *gin.Context) { }) return } + if updatedUser.Password == "" { + updatedUser.Password = "$I_LOVE_U" // make Validator happy :) + } if err := common.Validate.Struct(&updatedUser); err != nil { c.JSON(http.StatusOK, gin.H{ "success": false, @@ -325,6 +328,9 @@ func UpdateUser(c *gin.Context) { }) return } + if updatedUser.Password == "$I_LOVE_U" { + updatedUser.Password = "" // rollback to what it should be + } updatePassword := updatedUser.Password != "" if err := updatedUser.Update(updatePassword); err != nil { c.JSON(http.StatusOK, gin.H{