otp-jwt 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/otp/active_record.rb +3 -0
- data/lib/otp/jwt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c54629c5b9a4eeda3f9019ab09ddacc4828530f
|
4
|
+
data.tar.gz: dd8eff09d8e026ed05474ab9354912bd23e3fbe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e40074ff075698128268c9fe3005419490842dc8a32bcc23ebc082080d38e273232f014d4ab75082703ab0fa0d74d2efa46d63cfec605ffd9f72531de4f5d12b
|
7
|
+
data.tar.gz: 8d974d37a87403d214d37663e98dd679f00b0912a6f7d7c90dcba2bb72916f9cb0008ba15c7f2c4f3a9c8bb40ebbaffe41fb82f58cf0cd2a4b4973c7cd007530
|
data/Gemfile.lock
CHANGED
data/lib/otp/active_record.rb
CHANGED
@@ -20,6 +20,7 @@ module OTP
|
|
20
20
|
# @return [String] or nil if no OTP is set
|
21
21
|
def otp
|
22
22
|
return nil if !valid? || !persisted? || otp_secret.blank?
|
23
|
+
|
23
24
|
otp_digits = self.class.const_get(:OTP_DIGITS)
|
24
25
|
hotp = ROTP::HOTP.new(otp_secret, digits: otp_digits)
|
25
26
|
|
@@ -33,6 +34,8 @@ module OTP
|
|
33
34
|
#
|
34
35
|
# @return true on success, false on failure
|
35
36
|
def verify_otp(otp)
|
37
|
+
return nil if !valid? || !persisted? || otp_secret.blank?
|
38
|
+
|
36
39
|
hotp = ROTP::HOTP.new(otp_secret, digits: OTP_DIGITS)
|
37
40
|
transaction do
|
38
41
|
otp_status = hotp.verify(otp.to_s, otp_counter)
|
data/lib/otp/jwt/version.rb
CHANGED