google-authenticator-rails 3.1.0 → 3.2.1

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
  SHA256:
3
- metadata.gz: cbb1026a266573661287bef3b6c6bdc3d378366301eb7d7c5f30ed7ea1f66c12
4
- data.tar.gz: 30a37ae8d964980695f17a4aab1c4dfc74e4e6d548180ef06eaa5c1eb7f5bc4f
3
+ metadata.gz: 24553cf253ac005e951bbd6937e3ec7da80c0d29dd1ea119cb8a51caaf22bce6
4
+ data.tar.gz: 529785446eb3b6ee2bcd66ecbc8aa1890b7efcfa6c6d98dcfd13a5f7e7663034
5
5
  SHA512:
6
- metadata.gz: 1340e9ebdcc67cdef420bc9d078f8c6c40a00fa6d276ff2f11b411070fc86bfd7eaf64ea0e7088ac253071fddbdf32c497fe5568e6edfd1a417022f2933bc3a4
7
- data.tar.gz: 18058f4a6a6680e6707b7838d2f7d2ea0aa33f99cdc4bf9aafcf5fd0d5674d94729e6b7736208f6f8f826d68ab76db6000e0a227088e68632c1d31dcd1b0e618
6
+ metadata.gz: f0592fa696434b350fe844fc6ef86959923d3796a86b7c13d7da70bd2e21da5fad36e6a21ad540ef1215b8d4146dd3f8d7d37f89874f85063afbe6cb2cb889f7
7
+ data.tar.gz: 79b74b86b86e509e34033b4c0da95d68b044d4bcaa255563ef18895234f42421c60074931a603c0c37e386222c19d667debbc25db25141ff5f98b42366b31d1e
data/Appraisals CHANGED
@@ -4,14 +4,6 @@ major = version_info.first.to_i
4
4
  minor = version_info[1].to_i
5
5
  hotfix = version_info.last.to_i
6
6
 
7
- appraise "rails-5.2" do
8
- gem "activerecord", "~> 5.2.0"
9
- end
10
-
11
- appraise "rails-6.0" do
12
- gem "activerecord", "~> 6.0.0"
13
- end
14
-
15
7
  appraise "rails-6.1" do
16
8
  gem "activerecord", "~> 6.1.0"
17
9
  end
data/CONTRIBUTING.md CHANGED
@@ -4,4 +4,8 @@
4
4
  2. Create your feature branch (`git checkout -b my-new-feature`)
5
5
  3. Commit your changes (`git commit -am 'Added some feature'`)
6
6
  4. Push to the branch (`git push origin my-new-feature`)
7
- 5. Create new Pull Request
7
+ 5. Create new Pull Request
8
+
9
+ ## Bug fixes
10
+
11
+ It's very helpful for me if you include a failing spec with your bug fix so I can verify the behavior that is changing.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- google-authenticator-rails (3.1.0)
4
+ google-authenticator-rails (3.2.1)
5
5
  actionpack
6
6
  activerecord
7
7
  rails
@@ -11,67 +11,67 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (7.0.3)
15
- actionpack (= 7.0.3)
16
- activesupport (= 7.0.3)
14
+ actioncable (7.0.4.2)
15
+ actionpack (= 7.0.4.2)
16
+ activesupport (= 7.0.4.2)
17
17
  nio4r (~> 2.0)
18
18
  websocket-driver (>= 0.6.1)
19
- actionmailbox (7.0.3)
20
- actionpack (= 7.0.3)
21
- activejob (= 7.0.3)
22
- activerecord (= 7.0.3)
23
- activestorage (= 7.0.3)
24
- activesupport (= 7.0.3)
19
+ actionmailbox (7.0.4.2)
20
+ actionpack (= 7.0.4.2)
21
+ activejob (= 7.0.4.2)
22
+ activerecord (= 7.0.4.2)
23
+ activestorage (= 7.0.4.2)
24
+ activesupport (= 7.0.4.2)
25
25
  mail (>= 2.7.1)
26
26
  net-imap
27
27
  net-pop
28
28
  net-smtp
29
- actionmailer (7.0.3)
30
- actionpack (= 7.0.3)
31
- actionview (= 7.0.3)
32
- activejob (= 7.0.3)
33
- activesupport (= 7.0.3)
29
+ actionmailer (7.0.4.2)
30
+ actionpack (= 7.0.4.2)
31
+ actionview (= 7.0.4.2)
32
+ activejob (= 7.0.4.2)
33
+ activesupport (= 7.0.4.2)
34
34
  mail (~> 2.5, >= 2.5.4)
35
35
  net-imap
36
36
  net-pop
37
37
  net-smtp
38
38
  rails-dom-testing (~> 2.0)
39
- actionpack (7.0.3)
40
- actionview (= 7.0.3)
41
- activesupport (= 7.0.3)
39
+ actionpack (7.0.4.2)
40
+ actionview (= 7.0.4.2)
41
+ activesupport (= 7.0.4.2)
42
42
  rack (~> 2.0, >= 2.2.0)
43
43
  rack-test (>= 0.6.3)
44
44
  rails-dom-testing (~> 2.0)
45
45
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
46
- actiontext (7.0.3)
47
- actionpack (= 7.0.3)
48
- activerecord (= 7.0.3)
49
- activestorage (= 7.0.3)
50
- activesupport (= 7.0.3)
46
+ actiontext (7.0.4.2)
47
+ actionpack (= 7.0.4.2)
48
+ activerecord (= 7.0.4.2)
49
+ activestorage (= 7.0.4.2)
50
+ activesupport (= 7.0.4.2)
51
51
  globalid (>= 0.6.0)
52
52
  nokogiri (>= 1.8.5)
53
- actionview (7.0.3)
54
- activesupport (= 7.0.3)
53
+ actionview (7.0.4.2)
54
+ activesupport (= 7.0.4.2)
55
55
  builder (~> 3.1)
56
56
  erubi (~> 1.4)
57
57
  rails-dom-testing (~> 2.0)
58
58
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
59
- activejob (7.0.3)
60
- activesupport (= 7.0.3)
59
+ activejob (7.0.4.2)
60
+ activesupport (= 7.0.4.2)
61
61
  globalid (>= 0.3.6)
62
- activemodel (7.0.3)
63
- activesupport (= 7.0.3)
64
- activerecord (7.0.3)
65
- activemodel (= 7.0.3)
66
- activesupport (= 7.0.3)
67
- activestorage (7.0.3)
68
- actionpack (= 7.0.3)
69
- activejob (= 7.0.3)
70
- activerecord (= 7.0.3)
71
- activesupport (= 7.0.3)
62
+ activemodel (7.0.4.2)
63
+ activesupport (= 7.0.4.2)
64
+ activerecord (7.0.4.2)
65
+ activemodel (= 7.0.4.2)
66
+ activesupport (= 7.0.4.2)
67
+ activestorage (7.0.4.2)
68
+ actionpack (= 7.0.4.2)
69
+ activejob (= 7.0.4.2)
70
+ activerecord (= 7.0.4.2)
71
+ activesupport (= 7.0.4.2)
72
72
  marcel (~> 1.0)
73
73
  mini_mime (>= 1.1.0)
74
- activesupport (7.0.3)
74
+ activesupport (7.0.4.2)
75
75
  concurrent-ruby (~> 1.0, >= 1.0.2)
76
76
  i18n (>= 1.6, < 2)
77
77
  minitest (>= 5.1)
@@ -82,75 +82,73 @@ GEM
82
82
  thor (>= 0.14.0)
83
83
  builder (3.2.4)
84
84
  chunky_png (1.4.0)
85
- concurrent-ruby (1.1.10)
85
+ concurrent-ruby (1.2.0)
86
86
  crass (1.0.6)
87
+ date (3.3.3)
87
88
  diff-lcs (1.5.0)
88
- digest (3.1.0)
89
89
  docile (1.4.0)
90
- erubi (1.10.0)
91
- globalid (1.0.0)
90
+ erubi (1.12.0)
91
+ globalid (1.1.0)
92
92
  activesupport (>= 5.0)
93
- i18n (1.10.0)
93
+ i18n (1.12.0)
94
94
  concurrent-ruby (~> 1.0)
95
95
  loofah (2.19.1)
96
96
  crass (~> 1.0.2)
97
97
  nokogiri (>= 1.5.9)
98
- mail (2.7.1)
98
+ mail (2.8.1)
99
99
  mini_mime (>= 0.1.1)
100
+ net-imap
101
+ net-pop
102
+ net-smtp
100
103
  marcel (1.0.2)
101
104
  method_source (1.0.0)
102
105
  mini_mime (1.1.2)
103
- minitest (5.16.0)
104
- net-imap (0.2.3)
105
- digest
106
+ minitest (5.17.0)
107
+ net-imap (0.3.4)
108
+ date
106
109
  net-protocol
107
- strscan
108
- net-pop (0.1.1)
109
- digest
110
+ net-pop (0.1.2)
110
111
  net-protocol
112
+ net-protocol (0.2.1)
111
113
  timeout
112
- net-protocol (0.1.3)
113
- timeout
114
- net-smtp (0.3.1)
115
- digest
114
+ net-smtp (0.3.3)
116
115
  net-protocol
117
- timeout
118
116
  nio4r (2.5.8)
119
- nokogiri (1.13.10-arm64-darwin)
117
+ nokogiri (1.14.2-arm64-darwin)
120
118
  racc (~> 1.4)
121
- racc (1.6.1)
122
- rack (2.2.3.1)
123
- rack-test (1.1.0)
124
- rack (>= 1.0, < 3)
125
- rails (7.0.3)
126
- actioncable (= 7.0.3)
127
- actionmailbox (= 7.0.3)
128
- actionmailer (= 7.0.3)
129
- actionpack (= 7.0.3)
130
- actiontext (= 7.0.3)
131
- actionview (= 7.0.3)
132
- activejob (= 7.0.3)
133
- activemodel (= 7.0.3)
134
- activerecord (= 7.0.3)
135
- activestorage (= 7.0.3)
136
- activesupport (= 7.0.3)
119
+ racc (1.6.2)
120
+ rack (2.2.6.2)
121
+ rack-test (2.0.2)
122
+ rack (>= 1.3)
123
+ rails (7.0.4.2)
124
+ actioncable (= 7.0.4.2)
125
+ actionmailbox (= 7.0.4.2)
126
+ actionmailer (= 7.0.4.2)
127
+ actionpack (= 7.0.4.2)
128
+ actiontext (= 7.0.4.2)
129
+ actionview (= 7.0.4.2)
130
+ activejob (= 7.0.4.2)
131
+ activemodel (= 7.0.4.2)
132
+ activerecord (= 7.0.4.2)
133
+ activestorage (= 7.0.4.2)
134
+ activesupport (= 7.0.4.2)
137
135
  bundler (>= 1.15.0)
138
- railties (= 7.0.3)
136
+ railties (= 7.0.4.2)
139
137
  rails-dom-testing (2.0.3)
140
138
  activesupport (>= 4.2.0)
141
139
  nokogiri (>= 1.6)
142
- rails-html-sanitizer (1.4.4)
140
+ rails-html-sanitizer (1.5.0)
143
141
  loofah (~> 2.19, >= 2.19.1)
144
- railties (7.0.3)
145
- actionpack (= 7.0.3)
146
- activesupport (= 7.0.3)
142
+ railties (7.0.4.2)
143
+ actionpack (= 7.0.4.2)
144
+ activesupport (= 7.0.4.2)
147
145
  method_source
148
146
  rake (>= 12.2)
149
147
  thor (~> 1.0)
150
148
  zeitwerk (~> 2.5)
151
149
  rake (13.0.6)
152
- rotp (6.2.0)
153
- rqrcode (2.1.1)
150
+ rotp (6.2.2)
151
+ rqrcode (2.1.2)
154
152
  chunky_png (~> 1.0)
155
153
  rqrcode_core (~> 1.0)
156
154
  rqrcode_core (1.2.0)
@@ -174,15 +172,14 @@ GEM
174
172
  simplecov-html (0.12.3)
175
173
  simplecov_json_formatter (0.1.4)
176
174
  sqlite3 (1.4.2)
177
- strscan (3.0.3)
178
175
  thor (1.2.1)
179
- timeout (0.3.0)
180
- tzinfo (2.0.4)
176
+ timeout (0.3.2)
177
+ tzinfo (2.0.6)
181
178
  concurrent-ruby (~> 1.0)
182
179
  websocket-driver (0.7.5)
183
180
  websocket-extensions (>= 0.1.0)
184
181
  websocket-extensions (0.1.5)
185
- zeitwerk (2.6.0)
182
+ zeitwerk (2.6.7)
186
183
 
187
184
  PLATFORMS
188
185
  ruby
@@ -28,7 +28,9 @@ module GoogleAuthenticatorRails # :nodoc:
28
28
  end
29
29
 
30
30
  def google_authentic?(code)
31
- GoogleAuthenticatorRails.valid?(code, google_secret_value, self.class.google_drift)
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)
@@ -1,3 +1,3 @@
1
1
  module GoogleAuthenticatorRails
2
- VERSION = "3.1.0"
2
+ VERSION = "3.2.1"
3
3
  end
@@ -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.1.0
4
+ version: 3.2.1
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-02-18 00:00:00.000000000 Z
11
+ date: 2023-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rotp