devise-pwned_password 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/devise/pwned_password/model.rb +8 -1
- data/lib/devise/pwned_password/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 312151610ff6e4356a09f6221bb5006c8f8bdc50b10af1528441dc4c669f3ab1
|
4
|
+
data.tar.gz: 20000f8294c2b771cb593879462298cf86f56dcaef048e118efb90d1969fbef8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1489bdd8a923bf5d249869b0ac84e950174b409c1e265721aee3101c9cba2eb690a921d4891f885d2aba9ab542a91a0069797eaff86cc2ac2c7d5bcd0bae693
|
7
|
+
data.tar.gz: b9dd8b2c3dd4342f6a228b56ed1f83738beb61b93cf66f21e09fad54a37ba1673e45c6c89e74b4cbbaa3b445466a4ff6bc3a3ee5ec53fa17d8618206047f68ad
|
@@ -27,10 +27,16 @@ module Devise
|
|
27
27
|
@pwned ||= false
|
28
28
|
end
|
29
29
|
|
30
|
+
def pwned_count
|
31
|
+
@pwned_count ||= 0
|
32
|
+
end
|
33
|
+
|
30
34
|
# Returns true if password is present in the PwnedPasswords dataset
|
31
35
|
# Implement retry behaviour described here https://haveibeenpwned.com/API/v2#RateLimiting
|
32
36
|
def password_pwned?(password)
|
33
37
|
@pwned = false
|
38
|
+
@pwned_count = 0
|
39
|
+
|
34
40
|
options = {
|
35
41
|
"User-Agent" => "devise_pwned_password",
|
36
42
|
read_timeout: self.class.pwned_password_read_timeout,
|
@@ -38,7 +44,8 @@ module Devise
|
|
38
44
|
}
|
39
45
|
pwned_password = Pwned::Password.new(password.to_s, options)
|
40
46
|
begin
|
41
|
-
@
|
47
|
+
@pwned_count = pwned_password.pwned_count
|
48
|
+
@pwned = @pwned_count >= self.class.min_password_matches
|
42
49
|
return @pwned
|
43
50
|
rescue Pwned::Error
|
44
51
|
return false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-pwned_password
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Banfield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.7.6
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Devise extension that checks user passwords against the PwnedPasswords dataset.
|