nobspw 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -1
- data/lib/active_model/validations/password_validator.rb +1 -0
- data/lib/nobspw/password_checker.rb +0 -1
- data/lib/nobspw/validation_methods.rb +17 -1
- data/lib/nobspw/version.rb +1 -1
- data/nobspw.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50bde3af21d4ae1a914fdf29d97c7cd4636f9045d12053b19b03b10562432200
|
4
|
+
data.tar.gz: bb15b53c7660e771fd4d0d430be1882186d11515662d1ffe9f221478f4df0013
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8688c43975ea97d01f0bb39d8213dd221f7e4ec1022cba7b068e079c7e6213a826dc36949b90582ca2e3e8a23b9f7e9388904357c2166deaf5ef614ea646f83
|
7
|
+
data.tar.gz: 1c2f2a8835ab93d53bcb187bc7eb86123280d2c831114a7c5f26822708ee44ac1d20ac41c797a8a9b0d57543a44a0de3c3bcb1104a6f4cbea2c8c4033e9db871
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -61,7 +61,7 @@ Optionally, you can configure some options:
|
|
61
61
|
config.dictionary_path = 'path/to/dictionary.txt'
|
62
62
|
config.grep_path = '/usr/bin/grep'
|
63
63
|
config.domain_name = 'mywebsitedomain.com' # it is recommended you configure this
|
64
|
-
config.blacklist = ['this_password_is_not_allowed']
|
64
|
+
config.blacklist = ['this_password_is_not_allowed', /password/]
|
65
65
|
end
|
66
66
|
```
|
67
67
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class ActiveModel::Validations::PasswordValidator < ActiveModel::EachValidator
|
2
2
|
DEFAULT_ERROR_MESSAGES = {
|
3
3
|
name_included_in_password: 'is too similar to your name',
|
4
|
+
username_included_in_password: 'is too similar to your username',
|
4
5
|
email_included_in_password: 'is too similar to your email',
|
5
6
|
domain_included_in_password: 'is too similar to this domain name',
|
6
7
|
password_too_short: 'is too short',
|
@@ -2,6 +2,7 @@ module NOBSPW
|
|
2
2
|
module ValidationMethods
|
3
3
|
DEFAULT_VALIDATION_METHODS = %i(password_empty?
|
4
4
|
name_included_in_password?
|
5
|
+
username_included_in_password?
|
5
6
|
email_included_in_password?
|
6
7
|
domain_included_in_password?
|
7
8
|
password_too_short?
|
@@ -24,6 +25,12 @@ module NOBSPW
|
|
24
25
|
words_included_in_password?(words)
|
25
26
|
end
|
26
27
|
|
28
|
+
def username_included_in_password?
|
29
|
+
return nil unless @username
|
30
|
+
words = remove_word_separators(@username).split(' ')
|
31
|
+
words_included_in_password?(words)
|
32
|
+
end
|
33
|
+
|
27
34
|
def email_included_in_password?
|
28
35
|
return nil unless @email
|
29
36
|
words = remove_word_separators(email_without_extension(@email)).split(' ')
|
@@ -40,7 +47,16 @@ module NOBSPW
|
|
40
47
|
|
41
48
|
def password_not_allowed?
|
42
49
|
return nil unless NOBSPW.configuration.blacklist
|
43
|
-
|
50
|
+
|
51
|
+
NOBSPW.configuration.blacklist.each do |expression|
|
52
|
+
if expression.is_a?(Regexp)
|
53
|
+
return true if @password.match?(expression)
|
54
|
+
else
|
55
|
+
return true if expression.to_s == @password
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
false
|
44
60
|
end
|
45
61
|
|
46
62
|
def password_too_short?
|
data/lib/nobspw/version.rb
CHANGED
data/nobspw.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "guard-rspec", "~> 4.7.3"
|
30
30
|
spec.add_development_dependency "activemodel", "~> 5.0"
|
31
31
|
spec.add_development_dependency "i18n", "~> 0.8.1"
|
32
|
+
spec.add_development_dependency "byebug"
|
32
33
|
|
33
34
|
if RUBY_PLATFORM =~ /darwin/
|
34
35
|
spec.add_development_dependency 'ruby_gntp', "~> 0.3.4"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nobspw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Mercier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.8.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: byebug
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: ruby_gntp
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
210
|
version: '0'
|
197
211
|
requirements: []
|
198
212
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.7.
|
213
|
+
rubygems_version: 2.7.6
|
200
214
|
signing_key:
|
201
215
|
specification_version: 4
|
202
216
|
summary: No Bullshit Password strength checker
|