You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm posting it here, because I'm not getting much luck on devise, and I have a feeling it might be related to warden specifically. Either way, I'd appreciate some help.
I'm trying to normalize emails inside devise, by changing request params in the controller. e.g. bla@googlemail.com will be normalized to bla@gmail.com. Whenever devise's current_user is accessed beforehand, it causes authentication to fail.
When anything accesses current_user (e.g. in a before_action inside the application controller), then:
authenticating with the real email (bla@gmail.com) works, but
authenticating with a different email (bla@googlemail.com, that normalizes to bla@gmail.com) fails...
I'd really appreciate some help on how to tackle this. I'm not particularly familiar with devise or warden's internals, but happy to do more digging if necessary. Just not too sure where to even start.
The text was updated successfully, but these errors were encountered:
I investigated this problem and found out that warden caches the strategies in the methodclear_strategies_cache!, which is called by authenticate! but also when current_user is called, which happens most likely in some ApplicationController before filter. The password authentication strategy then already used the content of request.params which isn't normalized yet.
I'm posting it here, because I'm not getting much luck on devise, and I have a feeling it might be related to warden specifically. Either way, I'd appreciate some help.
I'm trying to normalize emails inside devise, by changing request params in the controller. e.g.
bla@googlemail.com
will be normalized tobla@gmail.com
. Whenever devise'scurrent_user
is accessed beforehand, it causes authentication to fail.Reproducible problem at https://github.com/gingerlime/rails-devise/tree/reproduce (specifically this commit)
When anything accesses
current_user
(e.g. in abefore_action
inside the application controller), then:bla@gmail.com
) works, butbla@googlemail.com
, that normalizes tobla@gmail.com
) fails...I'd really appreciate some help on how to tackle this. I'm not particularly familiar with devise or warden's internals, but happy to do more digging if necessary. Just not too sure where to even start.
The text was updated successfully, but these errors were encountered: