jeremyevans / rodauth

Ruby's Most Advanced Authentication Framework
http://rodauth.jeremyevans.net
MIT License
1.65k stars 95 forks source link

redirect to the desired page if the password is incorrect #336

Closed Halvanhelv closed 1 year ago

Halvanhelv commented 1 year ago

How can I make sure that if the password was entered incorrectly when trying to update the redirect to the correct page was not the standard rodauth (I have a form to change the password is located next to other forms of updating the user's personal data)

janko commented 1 year ago

The after_login_failure hook will fire when email was correct but password wasn't, so you can redirect from it:

after_login_failure do
  set_redirect_error_flash "#{login_error_flash}#{invalid_password_messsage}"
  redirect "/settings/account"
end