From 5bc34be49f9f6517af2aab03e1d40b32c60a8afd Mon Sep 17 00:00:00 2001 From: helderbetiol <37706737+helderbetiol@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:25:11 +0200 Subject: [PATCH] fix(api) remove duplicate --- API/controllers/auth.go | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/API/controllers/auth.go b/API/controllers/auth.go index e1bfee92..b8aa8088 100644 --- a/API/controllers/auth.go +++ b/API/controllers/auth.go @@ -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).