two_factor_cookies 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/app/controllers/two_factor_cookies/toggle_two_factor_controller.rb +2 -1
- data/app/controllers/two_factor_cookies/two_factor_authentication_controller.rb +4 -2
- data/lib/two_factor_cookies/configuration.rb +2 -2
- data/lib/two_factor_cookies/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff154f3213027330160834208adbcc2133146e3e1eceecad33d671828fb9c2df
|
4
|
+
data.tar.gz: 738c73ec6492baf2f199c4f541344a6d13de93aeda526e7dc2cbffcff0f27be5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49c9b2184c673215c1b77f41134f074d993c961fb6672fdcf9aa46faf8f39a78957f55cf8d807d366b655d72be03923ada8819db8476bd9de6ed5f1b75a7f814
|
7
|
+
data.tar.gz: 23a823447e95bd805f90bdfc14ea81d79b7ee24790619ab01cb493d610c2f7c4840ca14f2262697ca38e6ee2d16772f88c70d62530a77c3c44fc4ab380041911
|
data/README.md
CHANGED
@@ -29,10 +29,11 @@ TwoFactorCookies.configure do |config|
|
|
29
29
|
config.otp_generation_secret_key = MUST BE FILLED
|
30
30
|
|
31
31
|
# Cookie expiry
|
32
|
+
# The values need to be an amount of seconds, for instance `30.minutes`. The gem adds this amount to the Time.zone.now and uses this to set the cookie's expiry
|
32
33
|
# When a user will need to perform 2fa again
|
33
|
-
# config.two_factor_authentication_expiry = 30.days
|
34
|
+
# config.two_factor_authentication_expiry = 30.days
|
34
35
|
# How much time a user has to type in the otp sent to his phone
|
35
|
-
# config.otp_expiry = 30.minutes
|
36
|
+
# config.otp_expiry = 30.minutes
|
36
37
|
|
37
38
|
# Twilio API credentials
|
38
39
|
config.twilio_account_sid = MUST BE FILLED
|
@@ -15,7 +15,8 @@ TwoFactorCookies.const_set('ToggleTwoFactorController',
|
|
15
15
|
|
16
16
|
redirect_to eval(TwoFactorCookies.configuration.engine_name).public_send(
|
17
17
|
TwoFactorCookies.configuration.confirm_phone_number_success_route,
|
18
|
-
current_user.to_param
|
18
|
+
current_user.to_param
|
19
|
+
)
|
19
20
|
end
|
20
21
|
|
21
22
|
def toggle_two_factor
|
@@ -33,6 +33,8 @@ TwoFactorCookies.const_set('TwoFactorAuthenticationController',
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def otp_verified?
|
36
|
+
return false unless cookies[:mfa].present?
|
37
|
+
|
36
38
|
TwoFactorCookies::OneTimePasswordGenerator.verify_code(
|
37
39
|
two_factor_authentication_params[:one_time_password],
|
38
40
|
parsed_mfa_cookie[:seed]
|
@@ -59,7 +61,7 @@ TwoFactorCookies.const_set('TwoFactorAuthenticationController',
|
|
59
61
|
value: JSON.generate(
|
60
62
|
standard_values.merge(additional_authentication_values)
|
61
63
|
),
|
62
|
-
expires: TwoFactorCookies.configuration.two_factor_authentication_expiry
|
64
|
+
expires: Time.zone.now + TwoFactorCookies.configuration.two_factor_authentication_expiry
|
63
65
|
}
|
64
66
|
end
|
65
67
|
|
@@ -67,7 +69,7 @@ TwoFactorCookies.const_set('TwoFactorAuthenticationController',
|
|
67
69
|
cookies.delete(:mfa)
|
68
70
|
cookies.encrypted[:mfa] = {
|
69
71
|
value: JSON.generate(seed: seed, user_name: current_user.public_send(TwoFactorCookies.configuration.username_field_name)),
|
70
|
-
expires: TwoFactorCookies.configuration.otp_expiry
|
72
|
+
expires: Time.zone.now + TwoFactorCookies.configuration.otp_expiry
|
71
73
|
}
|
72
74
|
end
|
73
75
|
|
@@ -8,8 +8,8 @@ module TwoFactorCookies
|
|
8
8
|
|
9
9
|
def initialize
|
10
10
|
@otp_generation_secret_key = nil
|
11
|
-
@two_factor_authentication_expiry = 30.days
|
12
|
-
@otp_expiry = 30.minutes
|
11
|
+
@two_factor_authentication_expiry = 30.days
|
12
|
+
@otp_expiry = 30.minutes
|
13
13
|
|
14
14
|
@twilio_account_sid = nil
|
15
15
|
@twilio_phone_number = nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: two_factor_cookies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolai Bach Woller
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 5.
|
47
|
+
version: '5.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 5.
|
54
|
+
version: '5.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: m
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,7 +143,7 @@ licenses:
|
|
143
143
|
- MIT
|
144
144
|
metadata:
|
145
145
|
allowed_push_host: https://rubygems.org
|
146
|
-
post_install_message:
|
146
|
+
post_install_message:
|
147
147
|
rdoc_options: []
|
148
148
|
require_paths:
|
149
149
|
- lib
|
@@ -158,8 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
162
|
-
signing_key:
|
161
|
+
rubygems_version: 3.3.7
|
162
|
+
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: Simple two factor logon - with Twilio SMS for code delivery
|
165
165
|
test_files: []
|