google-authenticator-rails 3.2.0 → 3.3.0
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 +4 -4
- data/Gemfile.lock +9 -10
- data/lib/google-authenticator-rails/action_controller/rails_adapter.rb +7 -1
- data/lib/google-authenticator-rails/active_record/helpers.rb +3 -1
- data/lib/google-authenticator-rails/version.rb +1 -1
- data/spec/google_authenticator_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ffad5bfabf4feb99336e67a1993f8cee9dcbf83878d643ca2f2ce15251e4829
|
4
|
+
data.tar.gz: 89dedb7cc930bbdd3d24e051f076774b3e24a4773c36e78647f3f326a2be311d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10456cb6cac6702c6dfe929790f7ee27219fc25757d22501c327c47c889f939c08736900422fbc436b4acd11386c1c75ac34ee685a788f404bba2a01b001a3d7
|
7
|
+
data.tar.gz: 696573e146ab6b003e323a056170c31a173c99a30da41f8b3ff53ecd0066d471997b93291295ef465e46c80ac23871ad67ab06c011ee555bc19c4f0c98f47dcd
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
google-authenticator-rails (3.
|
4
|
+
google-authenticator-rails (3.3.0)
|
5
5
|
actionpack
|
6
6
|
activerecord
|
7
7
|
rails
|
@@ -82,7 +82,7 @@ GEM
|
|
82
82
|
thor (>= 0.14.0)
|
83
83
|
builder (3.2.4)
|
84
84
|
chunky_png (1.4.0)
|
85
|
-
concurrent-ruby (1.2.
|
85
|
+
concurrent-ruby (1.2.2)
|
86
86
|
crass (1.0.6)
|
87
87
|
date (3.3.3)
|
88
88
|
diff-lcs (1.5.0)
|
@@ -103,8 +103,7 @@ GEM
|
|
103
103
|
marcel (1.0.2)
|
104
104
|
method_source (1.0.0)
|
105
105
|
mini_mime (1.1.2)
|
106
|
-
|
107
|
-
minitest (5.17.0)
|
106
|
+
minitest (5.18.0)
|
108
107
|
net-imap (0.3.4)
|
109
108
|
date
|
110
109
|
net-protocol
|
@@ -115,11 +114,10 @@ GEM
|
|
115
114
|
net-smtp (0.3.3)
|
116
115
|
net-protocol
|
117
116
|
nio4r (2.5.8)
|
118
|
-
nokogiri (1.14.2)
|
119
|
-
mini_portile2 (~> 2.8.0)
|
117
|
+
nokogiri (1.14.2-arm64-darwin)
|
120
118
|
racc (~> 1.4)
|
121
119
|
racc (1.6.2)
|
122
|
-
rack (2.2.6.
|
120
|
+
rack (2.2.6.4)
|
123
121
|
rack-test (2.0.2)
|
124
122
|
rack (>= 1.3)
|
125
123
|
rails (7.0.4.2)
|
@@ -167,13 +165,13 @@ GEM
|
|
167
165
|
diff-lcs (>= 1.2.0, < 2.0)
|
168
166
|
rspec-support (~> 3.4.0)
|
169
167
|
rspec-support (3.4.1)
|
170
|
-
simplecov (0.
|
168
|
+
simplecov (0.22.0)
|
171
169
|
docile (~> 1.1)
|
172
170
|
simplecov-html (~> 0.11)
|
173
171
|
simplecov_json_formatter (~> 0.1)
|
174
172
|
simplecov-html (0.12.3)
|
175
173
|
simplecov_json_formatter (0.1.4)
|
176
|
-
sqlite3 (1.4.
|
174
|
+
sqlite3 (1.4.4)
|
177
175
|
thor (1.2.1)
|
178
176
|
timeout (0.3.2)
|
179
177
|
tzinfo (2.0.6)
|
@@ -184,7 +182,8 @@ GEM
|
|
184
182
|
zeitwerk (2.6.7)
|
185
183
|
|
186
184
|
PLATFORMS
|
187
|
-
|
185
|
+
arm64-darwin-21
|
186
|
+
x86_64-linux
|
188
187
|
|
189
188
|
DEPENDENCIES
|
190
189
|
appraisal (~> 2.4.1)
|
@@ -37,5 +37,11 @@ module GoogleAuthenticatorRails
|
|
37
37
|
end
|
38
38
|
|
39
39
|
ActiveSupport.on_load(:action_controller) do
|
40
|
-
ActionController::Base
|
40
|
+
if defined?(ActionController::Base)
|
41
|
+
ActionController::Base.send(:include, GoogleAuthenticatorRails::ActionController::Integration)
|
42
|
+
end
|
43
|
+
|
44
|
+
if defined?(ActionController::API)
|
45
|
+
ActionController::API.send(:include, GoogleAuthenticatorRails::ActionController::Integration)
|
46
|
+
end
|
41
47
|
end
|
@@ -28,7 +28,9 @@ module GoogleAuthenticatorRails # :nodoc:
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def google_authentic?(code)
|
31
|
-
|
31
|
+
raise ArgumentError, "Can't authenticate before google secret is set!" unless google_secret_value.present?
|
32
|
+
|
33
|
+
GoogleAuthenticatorRails.valid?(code.to_s, google_secret_value, self.class.google_drift)
|
32
34
|
end
|
33
35
|
|
34
36
|
def google_qr_uri(size = nil)
|
@@ -80,6 +80,12 @@ describe GoogleAuthenticatorRails do
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
context 'integer code validation' do
|
84
|
+
subject { user.google_authentic?(code.to_i) }
|
85
|
+
|
86
|
+
it { should be true }
|
87
|
+
end
|
88
|
+
|
83
89
|
it 'creates a secret' do
|
84
90
|
user.set_google_secret
|
85
91
|
user.google_secret.should == secret
|
@@ -90,6 +96,12 @@ describe GoogleAuthenticatorRails do
|
|
90
96
|
@user.clear_google_secret!
|
91
97
|
@user.google_secret_value.should(be_nil) && @user.reload.google_secret_value.should(be_nil)
|
92
98
|
end
|
99
|
+
|
100
|
+
it 'raises exception when checking authenticity' do
|
101
|
+
@user.clear_google_secret!
|
102
|
+
|
103
|
+
expect { @user.google_authentic?(code) }.to raise_error(ArgumentError)
|
104
|
+
end
|
93
105
|
end
|
94
106
|
|
95
107
|
it_behaves_like 'handles nil secrets'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-authenticator-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared McFarland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rotp
|