authlogic-password-reset-tutorial icon indicating copy to clipboard operation
authlogic-password-reset-tutorial copied to clipboard

find_by_email is case sensitive

Open orangethunder opened this issue 12 years ago • 3 comments

Hi

Just ran into this issue with my own project. Authlogic also does this when looking up an email for login purposes, so we need to do the same on reset:

email = params[:email] 
@user = User.where("LOWER(email) = ?", email).first

Otherwise [email protected] will not match [email protected] when doing a reset, even though it does match when doing login / registration duplication check.

orangethunder avatar Apr 13 '12 10:04 orangethunder

The above is the default Authlogic behaviour which can of course be overrided, i.e. you can tell Authlogic to treat emails as case sensitive if you want.

orangethunder avatar Apr 13 '12 10:04 orangethunder

Whoops, email needs a downcase, this won't work otherwise...

orangethunder avatar Apr 13 '12 11:04 orangethunder

Ahh, right...

Do you think you can make a pull request with a fix? Since I have no app using Authlogic right now, I don't know if it's working or not.

rejeep avatar Apr 13 '12 16:04 rejeep