heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
23.95k stars 5.55k forks source link

Support procs for sign_in_after_reset_password config #5653

Open excid3 opened 11 months ago

excid3 commented 11 months ago

Using MFA with Devise, it would be great to support callable objects in the sign_in_after_reset_password config.

Example

config.sign_in_after_reset_password = ->(resource) { !resource.mfa_enabled? }

Originally, I had to override the passwords controller to change this behavior but it's much cleaner if Devise supports procs, lambdas, or any other callable object.

The resource is passed as an argument so this can be applied based upon user preferences.