fixed blocking important issues
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package customer
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"tm/internal/user"
|
||||
"tm/pkg/authorization"
|
||||
@@ -268,14 +269,14 @@ func (h *Handler) ResetCustomerPassword(c echo.Context) error {
|
||||
targetID := c.Param("id")
|
||||
result, err := h.service.AdminResetPassword(c.Request().Context(), actorID, targetID)
|
||||
if err != nil {
|
||||
switch err.Error() {
|
||||
case errInvalidCustomerID.Error():
|
||||
switch {
|
||||
case errors.Is(err, errInvalidCustomerID):
|
||||
return response.BadRequest(c, "Invalid id", "")
|
||||
case errCustomerNotFound.Error():
|
||||
case errors.Is(err, errCustomerNotFound):
|
||||
return response.NotFound(c, "Customer not found")
|
||||
case errCannotResetCustPassword.Error():
|
||||
case errors.Is(err, errCannotResetCustPassword):
|
||||
return response.Conflict(c, "Cannot reset password for this user")
|
||||
case errCustResetPasswordRate.Error():
|
||||
case errors.Is(err, errCustResetPasswordRate):
|
||||
return response.TooManyRequests(c, "Too many password reset requests")
|
||||
default:
|
||||
return response.InternalServerError(c, "Failed to reset password")
|
||||
|
||||
Reference in New Issue
Block a user