New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Email used as auth_key uses exact case #22
Comments
You can do something like below in Identitity model by monkey-patching authenticate method.. class Identity < OmniAuth::Identity::Models::ActiveRecord put whatever validations etc you wantcase in-sensitivedef self.authenticate(email, password) |
Another option would be to set the locate_conditions option in your Omniauth config, shown at the bottom of the README: https://github.com/intridea/omniauth-identity This is mine:
Note that as of right now, the omniauth-identity gem on Rubygems does not support this feature. You can install the Github version of omniauth-identity by adding this line to your Gemfile:
|
For the sake of clarity... #config/initializers/omniauth.rb
provider :identity, locate_conditions: lambda { |req|
{ model.auth_key => req['auth_key'].downcase }
} As ujeezy noted above, the omniauth-identity gem on Rubygems does not support this feature, this is still true. Make sure your gemfile is as he stated: #Gemfile
gem 'omniauth-identity', git: 'https://github.com/intridea/omniauth-identity.git' |
@joshua-robinson @eugeneotto
So it appears the documented solution to this is not reliable. |
I'm seeing this to. Is there a work-around for case insensitive email comparison? |
If you want to be quick and dirty downcase client side. |
Thanks Joshua. I've done it that way. Here is my code change in: app/views/identities/new.html.erb:
|
I just updated @joshua-robinson @eugeneotto's solution with the following condition to get around the registration error noted by @ericpeters0n. :locate_conditions => lambda { |req| { model.auth_key => (req['auth_key'].present? ? req['auth_key'].downcase : req['auth_key']) } } Still a bit hacky, but at least you don't have to worry about clients having javascript disabled. This is on the current version, too. |
It is now case insensitive! |
Omniauth Identity seems to make distinction between capitalization on comparison in the identity table. A valid user with an email stored as joe.smith@abcdomain.com will fail if the user enters into the login form: Joe.Smith@abcdomain.com.
Any workaround suggestions work for me...Rails 2 specific please.
The text was updated successfully, but these errors were encountered: