Hotfix twitter login#802
Closed
ebihara99999 wants to merge 2 commits into
Closed
Conversation
Contributor
|
@ebihara99999 Can you move this over to https://github.com/Sorcery/sorcery/? |
Author
|
Do you mean you ask me to create the same new pull request to the repo? |
Contributor
|
@ebihara99999 Yeah, this repo is going to be deprecated soon in favor of the Sorcery org. |
Contributor
|
Once this is moved over to the Sorcery org repo, I'll take a look at this. |
Author
|
I moved this to Sorcery/sorcery pull requests. I hope you read. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
About the bug
I found a bug with Twitter login with external module reported at the issue #800
How to fix
I tried to fix it by myself, then I add username property to and remove not null constraint of email from users in
lib/generators/sorcery/templates/migration/core.rb.Username is needed when you login with Twitter, but email isn't needed.
Without username property, it raises error(mentioned in issue #800).
Thinking about email, not null constraint in a database layer raises an error
at
user.sorcery_adapter.save(:validate => false)in#create_from_providerinlib/sorcery/model/submodules/external.rb.The error is:
Using #save with validate option, expected that a validation of email is ignored. The validation should be imposed only in model.
I wonder why tests don't fail, looking into specs.
In
spec/rails_app/db/migrate/core/20101224223620_create_users.rb, different from the migration template mentioned above, defined are columns username and email without not null constraint.I think users defined in tests is expected, and I fix in this way.
How to test
I run all tests by
bundle exec rpsec.I also confirmed expected migration template as follows:
I'm looking forward to a comment. Thank you for reading.