monban 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.rdoc +3 -0
- data/lib/monban/services/authentication.rb +4 -2
- data/lib/monban/services/password_reset.rb +6 -2
- data/lib/monban/services/sign_in.rb +5 -1
- data/lib/monban/services/sign_out.rb +6 -1
- data/lib/monban/services/sign_up.rb +3 -1
- data/lib/monban/version.rb +2 -2
- data/spec/monban/services/sign_out_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c8d75fe9becef4e85c00188afc6bd4ce6cc2add
|
4
|
+
data.tar.gz: 0a017b45d82756152678e35a3cbb0cd5c6caf362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86de815a9526d7f46a6af686918164ae081319ce596e0ab1f753113aeb43106169eb8c6b3f230b28218ced996bd5099f650d06460dc8c69fc007386fff4fd37b
|
7
|
+
data.tar.gz: 36865675f616268e793634a71e73a7243827a152d14de39ebf7a971b580439a8bd5435f4fdf7acf7f6ea5bcd348652e183ecde6a63e3bb76cab03eb006a453bf
|
data/NEWS.rdoc
CHANGED
@@ -18,7 +18,7 @@ module Monban
|
|
18
18
|
# @return [false] if authentication fails
|
19
19
|
def perform
|
20
20
|
if authenticated?
|
21
|
-
|
21
|
+
user
|
22
22
|
else
|
23
23
|
false
|
24
24
|
end
|
@@ -26,8 +26,10 @@ module Monban
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
+
attr_reader :user, :undigested_token
|
30
|
+
|
29
31
|
def authenticated?
|
30
|
-
|
32
|
+
user && Monban.compare_token(user.send(token_store_field), undigested_token)
|
31
33
|
end
|
32
34
|
|
33
35
|
def token_store_field
|
@@ -15,9 +15,13 @@ module Monban
|
|
15
15
|
# Perform the service.
|
16
16
|
def perform
|
17
17
|
field = Monban.config.user_token_store_field
|
18
|
-
digested_password = Monban.hash_token(
|
19
|
-
|
18
|
+
digested_password = Monban.hash_token(new_password)
|
19
|
+
user[field] = digested_password
|
20
20
|
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :user, :new_password
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
@@ -8,12 +8,17 @@ module Monban
|
|
8
8
|
# @param warden [Warden] warden
|
9
9
|
def initialize warden
|
10
10
|
@warden = warden
|
11
|
+
@user = warden.user
|
11
12
|
end
|
12
13
|
|
13
14
|
# Perform the service
|
14
15
|
def perform
|
15
|
-
|
16
|
+
warden.logout
|
16
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :warden, :user
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
@@ -16,11 +16,13 @@ module Monban
|
|
16
16
|
# Performs the service
|
17
17
|
# @see Monban::Configuration.default_creation_method
|
18
18
|
def perform
|
19
|
-
Monban.config.creation_method.call(
|
19
|
+
Monban.config.creation_method.call(user_params.to_hash)
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
+
attr_reader :user_params
|
25
|
+
|
24
26
|
def token_digest(user_params)
|
25
27
|
undigested_token = user_params[token_field]
|
26
28
|
unless undigested_token.blank?
|
data/lib/monban/version.rb
CHANGED
@@ -5,6 +5,7 @@ describe Monban::Services::SignOut, '#perform' do
|
|
5
5
|
it 'signs out the user' do
|
6
6
|
warden = double()
|
7
7
|
allow(warden).to receive(:logout)
|
8
|
+
allow(warden).to receive(:user).and_return(double())
|
8
9
|
|
9
10
|
Monban::Services::SignOut.new(warden).perform
|
10
11
|
expect(warden).to have_received(:logout)
|