hugalves
hugalves

Reputation: 373

How to handle invalid e-mail in password recovery using Devise

I'm trying to change redirect response after user submits an invalid e-mail (not stored in database).

To handle when the email is stored, following this instruction it's easy to figure out. But, how can I set the redirect response when the e-mail is invalid?

Any help? Thanks

Upvotes: 0

Views: 54

Answers (1)

Jeremy Green
Jeremy Green

Reputation: 8574

You'll want to start by following the instructions that you linked to in order to create a custom passwords_controller.rb. Then you need to override the create method from the original devise/passwords_controller.rb

https://github.com/plataformatec/devise/blob/master/app/controllers/devise/passwords_controller.rb#L12

Instead of respond_with(resource) when the email is not successfully sent you could redirect to wherever you want.

Upvotes: 1

Related Questions