Skip to content

Commit

Permalink
fix(api) remove duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
helderbetiol committed Jun 14, 2024
1 parent 473c4bc commit 5bc34be
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions API/controllers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,29 +582,6 @@ func getModifyPassDataFromBody(r *http.Request, userEmail string) (string, strin
return currentPassword, newPassword, isReset, nil
}

func getModifyPassDataFromBody(r *http.Request, userEmail string) (string, string, bool, error) {
isReset := false
hasCurrent := true
currentPassword := ""
var data map[string]interface{}
err := json.NewDecoder(r.Body).Decode(&data)
if err != nil {
return currentPassword, "", isReset, fmt.Errorf("invalid request")
}
if userEmail == u.RESET_TAG {
// it's not change, it's reset (no need for current password)
isReset = true
} else {
currentPassword, hasCurrent = data["currentPassword"].(string)
}
newPassword, hasNew := data["newPassword"].(string)
if !hasCurrent || !hasNew {
return currentPassword, "", isReset,
fmt.Errorf("invalid request: wrong body format")
}
return currentPassword, newPassword, isReset, nil
}

// swagger:operation POST /api/users/password/forgot Authentication UserForgotPassword
// Forgot my password.
// Public endpoint to request a reset of a user's password (forgot my password).
Expand Down

0 comments on commit 5bc34be

Please sign in to comment.