omniauth-multiprovider 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34da0ba445043816e1e3dd4f72f3c3551007c645
|
4
|
+
data.tar.gz: c533befeb3ee48612087b4420ece8865f4941c8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0607783b50c1c221f17eda643f2ef9b49f2b26b320b27c3fea0686f680c69bc7ceddeb6a162a90c6698776e364774980270e66ddf480794989b666e6c58279df
|
7
|
+
data.tar.gz: 39a34d6b61b6aec6a071e11b7e715747662d75928475b9e2ff8aced3100338da182b8b60ba638763c6fb590681e1f56102058722ff812a24e6a7230d4bfcb29b
|
@@ -12,6 +12,8 @@ module OmniAuth
|
|
12
12
|
access_token = auth.credentials.token
|
13
13
|
authentication = MultiProvider.authentication_klass.find_by(provider: provider_name, uid: auth.uid)
|
14
14
|
|
15
|
+
resource = nil
|
16
|
+
|
15
17
|
if authentication
|
16
18
|
if signed_in_resource
|
17
19
|
if authentication.resource == signed_in_resource
|
@@ -20,8 +22,9 @@ module OmniAuth
|
|
20
22
|
raise MultiProvider::Error.new 'already connected with other user'
|
21
23
|
end
|
22
24
|
end
|
23
|
-
authentication.resource
|
24
|
-
|
25
|
+
resource = authentication.resource
|
26
|
+
end
|
27
|
+
unless resource
|
25
28
|
if auth.info[:email].blank?
|
26
29
|
auth.info[:email] = MultiProvider::resource_klass.mock_email(provider_name, auth.uid)
|
27
30
|
end
|
@@ -29,15 +32,15 @@ module OmniAuth
|
|
29
32
|
|
30
33
|
raise MultiProvider::Error.new 'email_already_registered' if MultiProvider::resource_klass.find_by(email: email)
|
31
34
|
|
32
|
-
resource = signed_in_resource || MultiProvider::resource_klass.
|
35
|
+
resource = signed_in_resource || MultiProvider::resource_klass.new(
|
33
36
|
email: email,
|
34
37
|
password: Devise.friendly_token[0,20]
|
35
38
|
)
|
36
39
|
|
37
40
|
MultiProvider.authentication_klass.from(auth, resource)
|
38
41
|
|
39
|
-
resource
|
40
42
|
end
|
43
|
+
resource
|
41
44
|
end
|
42
45
|
|
43
46
|
def self.authenticate_from_oauth(provider_name, omniauth_data)
|
@@ -5,12 +5,13 @@ module OmniAuth
|
|
5
5
|
def self.init(provider_name)
|
6
6
|
klass = self
|
7
7
|
OmniAuth::MultiProvider::CallbacksController.add_callback(provider_name) do
|
8
|
-
|
8
|
+
auth = request.env['omniauth.auth']
|
9
|
+
resource = klass.find_from_oauth(provider_name, auth, send(OmniAuth::MultiProvider::current_resource))
|
9
10
|
if resource.persisted?
|
10
11
|
sign_in_and_redirect resource, event: :authentication #this will throw if resource is not activated
|
11
12
|
set_flash_message(:notice, :success, kind: provider_name.to_s.camelize) if is_navigational_format?
|
12
13
|
else
|
13
|
-
session["devise.#{provider_name}_data"] = auth
|
14
|
+
session["devise.#{provider_name}_data"] = auth.except('extra')
|
14
15
|
redirect_to send("new_#{OmniAuth::MultiProvider::resource_mapping}_registration_url")
|
15
16
|
end
|
16
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-multiprovider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- German Del Zotto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|