Commit 6793f3ff authored by Matheus Horstmann's avatar Matheus Horstmann 🐴

Merge branch 'password_reset_fix_internal_error' into 'develop'

Avoid internal server error when resetting password for unregistered CPF

See merge request !73
parents 143883cf 3399c98f
Pipeline #16868 passed with stages
in 3 minutes and 56 seconds
module Api::V1
module Api::V1
class Accounts::PasswordsController < DeviseTokenAuth::PasswordsController
# this action is responsible for generating password reset tokens and
......@@ -11,20 +11,20 @@ module Api::V1
# fall back to default value if provided
@redirect_url ||= DeviseTokenAuth.default_password_reset_url
unless @redirect_url
return render_create_error_missing_redirect_url
@resource = Account.find_by(uid: params[:cpf])
if or
@resource = Account.find_by(uid: params[:cpf])
if @resource.nil? or or
render json: {
errors: ["User #{params[:cpf]} does not have an email registered."]
}, status: 422
end = =
@email =
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment