google-authenticator-rails 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/README.md +4 -4
- data/lib/google-authenticator-rails/active_record/acts_as_google_authenticated.rb +1 -1
- data/lib/google-authenticator-rails/active_record/helpers.rb +1 -1
- data/lib/google-authenticator-rails/version.rb +1 -1
- data/spec/google_authenticator_spec.rb +10 -10
- 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: 57a6634f2b73dac86360989605c79d16759dd40ca359fb25b63c72cb22c77047
|
4
|
+
data.tar.gz: 5d80ab62bef5ee68a1e5c563052e4bbdfa4b3114a7152784cc8b8dcf98289e27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87478b013de71e4ed3b0e0854eece6d6031f517ce9156845a54ebb1da8e46e9386689878f319a5049df45959c977628d9f6bc566c3b9ca3c538e08db01c8c928
|
7
|
+
data.tar.gz: 9bcef76dcf19a4a9215ee5e3ddf1522eb2ae738e444811f70a6203e4a2c0af12b569cd37500fb7aec8194acbb0d75ca3715cb09b10bf3fdf8c1b786e3e0f1a75
|
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.4.0)
|
5
5
|
actionpack
|
6
6
|
activerecord
|
7
7
|
rails
|
@@ -183,6 +183,7 @@ GEM
|
|
183
183
|
|
184
184
|
PLATFORMS
|
185
185
|
arm64-darwin-21
|
186
|
+
ruby
|
186
187
|
x86_64-linux
|
187
188
|
|
188
189
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ end
|
|
33
33
|
@user = User.new
|
34
34
|
@user.set_google_secret # => true
|
35
35
|
@user.google_secret_value # => 16-character plain-text secret, whatever the name of the secret column
|
36
|
-
@user.google_qr_uri # => http://path.to.
|
36
|
+
@user.google_qr_uri # => http://path.to.chart/qr?with=params
|
37
37
|
@user.google_authentic?(123456) # => true
|
38
38
|
@user.clear_google_secret! # => true
|
39
39
|
@user.google_secret_value # => nil
|
@@ -137,7 +137,7 @@ For example:
|
|
137
137
|
```ruby
|
138
138
|
# app/models/user.rb
|
139
139
|
class User < ActiveRecord::Base
|
140
|
-
|
140
|
+
acts_as_google_authenticated
|
141
141
|
end
|
142
142
|
|
143
143
|
# app/models/user_mfa_session.rb
|
@@ -162,7 +162,7 @@ For example:
|
|
162
162
|
```ruby
|
163
163
|
# app/models/user.rb
|
164
164
|
class User < ActiveRecord::Base
|
165
|
-
|
165
|
+
acts_as_google_authenticated
|
166
166
|
end
|
167
167
|
|
168
168
|
# Model has attributes:
|
@@ -187,7 +187,7 @@ The above example will fail because the `User` class doesn't have a `persistence
|
|
187
187
|
```ruby
|
188
188
|
# app/models/user.rb
|
189
189
|
class User < ActiveRecord::Base
|
190
|
-
|
190
|
+
acts_as_google_authenticated :lookup_token => :salt
|
191
191
|
end
|
192
192
|
|
193
193
|
# Model has attributes:
|
@@ -21,7 +21,7 @@ module GoogleAuthenticatorRails # :nodoc:
|
|
21
21
|
# @user = user.new
|
22
22
|
# @user.set_google_secret # => true
|
23
23
|
# @user.google_secret_value # => 16-character decrypted secret
|
24
|
-
# @user.google_qr_uri # => http://path.to.
|
24
|
+
# @user.google_qr_uri # => http://path.to.chart/qr?with=params
|
25
25
|
# @user.google_authentic?(123456) # => true
|
26
26
|
#
|
27
27
|
# Google Labels
|
@@ -35,7 +35,7 @@ module GoogleAuthenticatorRails # :nodoc:
|
|
35
35
|
|
36
36
|
def google_qr_uri(size = nil)
|
37
37
|
data = ROTP::TOTP.new(google_secret_value, :issuer => google_issuer).provisioning_uri(google_label)
|
38
|
-
"https://
|
38
|
+
"https://image-charts.com/chart?cht=qr&chl=#{CGI.escape(data)}&chs=#{size || self.class.google_qr_size}"
|
39
39
|
end
|
40
40
|
|
41
41
|
def google_qr_to_base64(size = 200)
|
@@ -138,7 +138,7 @@ describe GoogleAuthenticatorRails do
|
|
138
138
|
end
|
139
139
|
|
140
140
|
it 'generates a url for a qr code' do
|
141
|
-
@user.google_qr_uri.should == "https://
|
141
|
+
@user.google_qr_uri.should == "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=200x200"
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
@@ -245,48 +245,48 @@ describe GoogleAuthenticatorRails do
|
|
245
245
|
before { user.set_google_secret }
|
246
246
|
subject { user.google_qr_uri }
|
247
247
|
|
248
|
-
it { should eq "https://
|
248
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=200x200" }
|
249
249
|
|
250
250
|
context 'custom column name' do
|
251
251
|
let(:user) { UserFactory.create ColumnNameUser }
|
252
|
-
it { should eq "https://
|
252
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest_user%3Fsecret%3D#{secret}&chs=200x200" }
|
253
253
|
end
|
254
254
|
|
255
255
|
context 'custom proc' do
|
256
256
|
let(:user) { UserFactory.create ProcLabelUser }
|
257
|
-
it { should eq "https://
|
257
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest_user%2540futureadvisor-admin%3Fsecret%3D#{secret}&chs=200x200" }
|
258
258
|
end
|
259
259
|
|
260
260
|
context 'custom issuer' do
|
261
261
|
let(:user) { UserFactory.create ProcIssuerUser }
|
262
|
-
it { should eq "https://
|
262
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2FFA%2520Admin%3Atest%2540example.com%3Fsecret%3D#{secret}%26issuer%3DFA%2520Admin&chs=200x200" }
|
263
263
|
end
|
264
264
|
|
265
265
|
context 'method defined by symbol' do
|
266
266
|
let(:user) { UserFactory.create SymbolUser }
|
267
|
-
it { should eq "https://
|
267
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=200x200" }
|
268
268
|
end
|
269
269
|
|
270
270
|
context 'method defined by string' do
|
271
271
|
let(:user) { UserFactory.create StringUser }
|
272
|
-
it { should eq "https://
|
272
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=200x200" }
|
273
273
|
end
|
274
274
|
|
275
275
|
context 'custom qr size' do
|
276
276
|
let(:user) { UserFactory.create QrCodeUser }
|
277
|
-
it { should eq "https://
|
277
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=300x300" }
|
278
278
|
end
|
279
279
|
|
280
280
|
context 'qr size passed to method' do
|
281
281
|
subject { user.google_qr_uri('400x400') }
|
282
282
|
let(:user) { UserFactory.create StringUser }
|
283
|
-
it { should eq "https://
|
283
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=400x400" }
|
284
284
|
end
|
285
285
|
|
286
286
|
context 'qr size passed to method and size set on model' do
|
287
287
|
let(:user) { UserFactory.create QrCodeUser }
|
288
288
|
subject { user.google_qr_uri('400x400') }
|
289
|
-
it { should eq "https://
|
289
|
+
it { should eq "https://image-charts.com/chart?cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%2540example.com%3Fsecret%3D#{secret}&chs=400x400" }
|
290
290
|
end
|
291
291
|
|
292
292
|
context 'generates base64 image' do
|
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.4.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:
|
11
|
+
date: 2024-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rotp
|