81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/sorcery/model/submodules/external.rb', line 81
def add_provider_to_user(provider, uid)
authentications = sorcery_config.authentications_class.name.underscore.pluralize
if sorcery_adapter.find_authentication_by_oauth_credentials(authentications, provider, uid).nil?
user = send(authentications).build(sorcery_config.provider_uid_attribute_name => uid,
sorcery_config.provider_attribute_name => provider)
user.sorcery_adapter.save(validate: false)
else
user = false
end
user
end
|