active_model_otp 2.3.0 → 2.3.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: 2a57a05fda7ae2023dc877a96228e00e5dbca948bc8d17c1058232a42086e285
4
- data.tar.gz: 9d3a965117edbf33fb77585126be84e2fd44b613bbbc435c74627b198b87ee5f
3
+ metadata.gz: 906ff23803a070afb3df376eb45d4314640c4f4012028d7b7bfc16d9263def54
4
+ data.tar.gz: efde68de226fb2d7a5b2230fc19958502e678776781419ff89532d19d5e9682e
5
5
  SHA512:
6
- metadata.gz: 847accabdd4eff2942a917f497197b3be90bb5cf9e9caefb0cd753635994e3bb8b730aab0d9387aa13c4e929793816333d094b620037a8f9c002a7cc3f3ebdcb
7
- data.tar.gz: 6a47a8a378bdb2d9155a165e503f672b5c57576c7f9d4fdef271767422a2d9804a141252707cb0181b02c36a91024d1867b9114cdbc95e475c2e4b292f750b65
6
+ metadata.gz: 2805bf0a8dc09e6699b9617b60f662b4ff50c82c4f952d9e0fdc2a9c2c6c5a5829ea42ceb9bb2167d64d83c050a79272b3224cc0e21ecb93069fde5cc826f9ba
7
+ data.tar.gz: c893d4e40737f2a724e912dd84edfc1cbd3886515757596582436d2694d2ab4836ae7251a522e66c3ac95f31fef4c52f1d1f47836d09d39cb7d259c6c335c77d
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/heapsource/active_model_otp.png)](https://travis-ci.org/heapsource/active_model_otp)
1
+ [![Active Model OTP](https://github.com/heapsource/active_model_otp/actions/workflows/active_model_otp.yml/badge.svg?branch=main)](https://github.com/heapsource/active_model_otp/actions/workflows/active_model_otp.yml)
2
2
  [![Gem Version](https://badge.fury.io/rb/active_model_otp.svg)](http://badge.fury.io/rb/active_model_otp)
3
3
  [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
4
4
 
@@ -72,6 +72,7 @@ module ActiveModel
72
72
  end
73
73
 
74
74
  def authenticate_otp(code, options = {})
75
+ return false if code.nil? || code.empty?
75
76
  return true if backup_codes_enabled? && authenticate_backup_code(code)
76
77
 
77
78
  if otp_counter_based
@@ -1,5 +1,5 @@
1
1
  module ActiveModel
2
2
  module Otp
3
- VERSION = '2.3.0'.freeze
3
+ VERSION = '2.3.1'.freeze
4
4
  end
5
5
  end
@@ -33,6 +33,23 @@ class OtpTest < MiniTest::Test
33
33
  assert @visitor.authenticate_otp(code)
34
34
  end
35
35
 
36
+ def test_authenticate_with_otp_passing_false_or_empty_codes
37
+ refute @user.authenticate_otp(nil)
38
+ refute @user.authenticate_otp('')
39
+
40
+ refute @visitor.authenticate_otp(nil)
41
+ refute @visitor.authenticate_otp('')
42
+
43
+ refute @member.authenticate_otp(nil)
44
+ refute @member.authenticate_otp('')
45
+
46
+ refute @ar_user.authenticate_otp(nil)
47
+ refute @ar_user.authenticate_otp('')
48
+
49
+ refute @opt_in.authenticate_otp(nil)
50
+ refute @opt_in.authenticate_otp('')
51
+ end
52
+
36
53
  def test_counter_based_otp
37
54
  code = @member.otp_code
38
55
  assert @member.authenticate_otp(code)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_model_otp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillermo Iguaran
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-06-22 00:00:00.000000000 Z
13
+ date: 2021-10-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel