devise_g5_authenticatable 0.1.1 → 0.1.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: efb202ccac3050c390f4aee7ef1afdf625437574
|
4
|
+
data.tar.gz: 89c6a1f7f1aaebe7123a321c1ceec726ee17e4b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4af967f531a3b3e974cdb46d462cf86a25302357af9a46ff62bc864f4253a0c99759e0bd14c7a4394798bb331dfe559b7d072c6fe54aeecd60ee71564e28bf19
|
7
|
+
data.tar.gz: 075ebbe92655bb91e49b35df46341d546a6dc6994f6e482e22ebd74844b07ee234f1c138660edecc8bcd49b1a9c84eaa011a9a8a6a6ea4594f013001dac4c865
|
data/CHANGELOG.md
CHANGED
@@ -23,13 +23,21 @@ module Devise
|
|
23
23
|
auth_client.create_user(auth_user_args)
|
24
24
|
rescue StandardError => e
|
25
25
|
if e.message =~ /Email has already been taken/
|
26
|
-
|
26
|
+
existing_auth_user
|
27
27
|
else
|
28
28
|
raise e
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def existing_auth_user
|
34
|
+
user = auth_client.find_user_by_email(model.email)
|
35
|
+
user.password = model.password
|
36
|
+
user.password_confirmation = model.password
|
37
|
+
auth_client.update_user(user.to_hash)
|
38
|
+
user
|
39
|
+
end
|
40
|
+
|
33
41
|
def auth_user_exists?
|
34
42
|
!model.uid.blank?
|
35
43
|
end
|
@@ -15,9 +15,17 @@ describe Devise::G5::AuthUserCreator do
|
|
15
15
|
let(:updated_by) {}
|
16
16
|
let(:password) { 'new password' }
|
17
17
|
let(:password_confirmation) { 'new password confirmation' }
|
18
|
+
let(:other_password) { 'blah' }
|
18
19
|
|
19
20
|
let(:auth_client) { double(:g5_authentication_client) }
|
20
|
-
|
21
|
+
|
22
|
+
let(:auth_user) { double(:auth_user,
|
23
|
+
id: uid,
|
24
|
+
email: model.email,
|
25
|
+
password: other_password,
|
26
|
+
clean_up_passwords: nil,
|
27
|
+
to_hash: {}) }
|
28
|
+
|
21
29
|
let(:uid) { 'remote-auth-user-42' }
|
22
30
|
|
23
31
|
before do
|
@@ -29,11 +37,19 @@ describe Devise::G5::AuthUserCreator do
|
|
29
37
|
model.uid = nil
|
30
38
|
allow(auth_client).to receive(:create_user).and_raise(StandardError.new('Email has already been taken'))
|
31
39
|
allow(auth_client).to receive(:find_user_by_email).and_return(auth_user)
|
32
|
-
|
40
|
+
allow(auth_client).to receive(:update_user)
|
33
41
|
end
|
34
42
|
|
35
43
|
it 'should create the local user with the existing uid' do
|
36
|
-
|
44
|
+
allow(auth_user).to receive(:password=)
|
45
|
+
allow(auth_user).to receive(:password_confirmation=)
|
46
|
+
expect{ create }.to change(model, :uid).to uid
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should reset the password' do
|
50
|
+
expect(auth_user).to receive(:password=).with(password)
|
51
|
+
expect(auth_user).to receive(:password_confirmation=).with(password)
|
52
|
+
create
|
37
53
|
end
|
38
54
|
end
|
39
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_g5_authenticatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maeve Revels
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|