sorcery icon indicating copy to clipboard operation
sorcery copied to clipboard

Sorcery excepts the same email/username more than once

Open eliajf opened this issue 9 years ago • 4 comments

Create an account with [email protected] and create another account with [email protected]. Sorcery will allow this. Case should not matter for email addresses (nor username if used for login/account creation purposes).

Furthermore, user.downcase_username_before_authenticating should be true by default (or at least set to true should also impact account creation).

For anyone looking for a work-around, I fixed this by setting user.downcase_username_before_authenticating to true in config/initializers/sorcery.rb and @user.email.downcase! to users_controller/create

eliajf avatar Aug 11 '15 22:08 eliajf

:+1: for enabling this by default.

coderhs avatar Aug 14 '15 09:08 coderhs

:+1:

shime avatar Aug 25 '15 07:08 shime

Hi @eliajf!

I agree with you, we can switch this setting to true by default. What's more, if someone wants to implement it, we can add a before_validate callback, that would downcase email/login before saving record (only if the downcase_username_before_authenticating is set to true). This would prevent the first problem you've mentioned

arnvald avatar Sep 23 '15 16:09 arnvald

That's fair and is exactly what I implemented myself. I'd urge you to set downcase_username_before_authenticating to true by default as well. Thanks for being open to suggestions.

On Wed, Sep 23, 2015 at 9:44 AM, Grzegorz Witek [email protected] wrote:

Hi @eliajf https://github.com/eliajf!

I agree with you, we can switch this setting to true by default. What's more, if someone wants to implement it, we can add a before_validate callback, that would downcase email/login before saving record (only if the downcase_username_before_authenticating is set to true). This would prevent the first problem you've mentioned

— Reply to this email directly or view it on GitHub https://github.com/NoamB/sorcery/issues/712#issuecomment-142658503.

Elia Freedman Infinity Softworks (503) 939-4379 www.infinitysw.com @eliajf

eliajf avatar Sep 23 '15 16:09 eliajf