-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Honor strip_whitespace_keys from devise config #1028
Conversation
This change looks good to me. Any idea why the tests are failing? I need to figure out how to disable all of those warnings in travis - it's impossible to see what the actual error was through all the noise. |
Hi, I tried to run the test suite on ruby 2.4.2 and all three databases (sqlite, mysql and postgresql, albeit version 10) and it failed the first time, but mysteriously worked on the second and following times. I have no idea why at the moment, so I was looking for a way to restart the build and see if it would fix itself... 😄 |
The error may be unrelated to this PR. I'll pull down and test ASAP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but I see that travis is failing in the test that you added ("request should succeed if configured")
closing and reopening to try running the tests again |
Unfortunately looks like tests are still failing here :( |
Looks like this is the failing test:
@nerfologist are you sure you're setting the class variable correctly? @resource_class.strip_whitespace_keys = [:email] Could it be that you have to do something like this? @resource_class.class_variable_set(:@@strip_whitespace_keys = [:email]) |
Thanks all for your feedback, I'll look into it ASAP. |
There was a leftover I can't figure out why it kind of worked for most ruby versions/databases though 🤔 ... possibly some databases were not performing a case-sensitive string match. Let me know if you want me to squash all commits! 👍 |
It's okay, thanks! If someone else approves this PR, we'll merge it |
Hello,
in our application some (clumsy?) users are including whitespace before or after their email address when trying to log in, and failing (credentials were being rejected). We are also not stripping the whitespace in the front-end.
Based on our understanding, it seems that
devise_token_auth
is not honoring thestrip_whitespace_keys
as set inconfig/initializers/devise.rb
.This small patch will strip whitespace according to the
strip_whitespace_keys
configuration.(tested and passing on Ruby 2.4.1)
Hope to help, thanks for this great gem!
Marco