Skip to content
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

Correct variable name and remove unneeded #261

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/sorcery/model/submodules/external.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,12 @@ def add_provider_to_user(provider, uid)
authentications = sorcery_config.authentications_class.name.demodulize.underscore.pluralize
# first check to see if user has a particular authentication already
if sorcery_adapter.find_authentication_by_oauth_credentials(authentications, provider, uid).nil?
user = send(authentications).build(sorcery_config.provider_uid_attribute_name => uid,
authentication = send(authentications).build(sorcery_config.provider_uid_attribute_name => uid,
sorcery_config.provider_attribute_name => provider)
user.sorcery_adapter.save(validate: false)
authentication.sorcery_adapter.save(validate: false)
else
user = false
false
Comment on lines +99 to +103
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, looking closer at this, I think this changes the return value when the authentication is present. Previously it would return authentication, but with this change it would instead return authentication.sorcery_adapter.save(validate: false) as that's the last value called in the method.

Can you revert the second part of this, and keep it to just renaming the variable to be more accurate?

end

user
end
end
end
Expand Down