strong_password 0.0.2 → 0.0.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a600fb2188e5ef68fe1b87858877a68d31483313
|
4
|
+
data.tar.gz: afc7d66403cbeeb173729c408786854191b9493a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9c3e4ea577f25cbfe3183aecef9b24cab9d62d5da52102d5a4c5ae30c628caa47bf37339099b714c990360c80147706350885346b5348badf0abe67447d0734
|
7
|
+
data.tar.gz: 74f6fdb63104cbc0cb39713337236b3d96670286472ffcd6eb8e22728577744ef0f5e03fabf16be99ce27375b1f8808d6c15599fb019414f639d8617f02d6147
|
@@ -4,9 +4,9 @@ module ActiveModel
|
|
4
4
|
module Validations
|
5
5
|
class PasswordStrengthValidator < ActiveModel::EachValidator
|
6
6
|
def validate_each(object, attribute, value)
|
7
|
-
ps = ::StrongPassword::StrengthChecker.new(value)
|
7
|
+
ps = ::StrongPassword::StrengthChecker.new(value.to_s)
|
8
8
|
unless ps.is_strong?(strength_options(options, object))
|
9
|
-
object.errors.add(attribute, :'password.password_strength', options.merge(:value => value))
|
9
|
+
object.errors.add(attribute, :'password.password_strength', options.merge(:value => value.to_s))
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -28,7 +28,7 @@ module ActiveModel
|
|
28
28
|
extra_words || []
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
module HelperMethods
|
33
33
|
# class User < ActiveRecord::Base
|
34
34
|
# validates_password_strength :password
|
@@ -9,7 +9,7 @@ class TestBaseStrength < User
|
|
9
9
|
validates :password, password_strength: true
|
10
10
|
end
|
11
11
|
|
12
|
-
class TestStrengthWeakEntropy< User
|
12
|
+
class TestStrengthWeakEntropy < User
|
13
13
|
validates :password, password_strength: {min_entropy: 1, use_dictionary: true}
|
14
14
|
end
|
15
15
|
|
@@ -33,11 +33,12 @@ module ActiveModel
|
|
33
33
|
let(:strong_entropy) { TestStrengthStrongEntropy.new }
|
34
34
|
let(:extra_words) { TestStrengthExtraWords.new }
|
35
35
|
let(:alternative_usage) { TestBaseStrengthAlternative.new }
|
36
|
-
|
36
|
+
|
37
37
|
describe 'validations' do
|
38
38
|
describe 'base strength' do
|
39
39
|
describe 'invalid' do
|
40
40
|
[
|
41
|
+
nil,
|
41
42
|
'password',
|
42
43
|
'1234',
|
43
44
|
'f0bar',
|
@@ -50,7 +51,7 @@ module ActiveModel
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|
53
|
-
|
54
|
+
|
54
55
|
describe 'valid' do
|
55
56
|
[
|
56
57
|
'p@ssw0fdsafsdafrd',
|
@@ -66,7 +67,7 @@ module ActiveModel
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
end
|
69
|
-
|
70
|
+
|
70
71
|
describe 'alternative usage' do
|
71
72
|
describe 'invalid' do
|
72
73
|
[
|
@@ -82,7 +83,7 @@ module ActiveModel
|
|
82
83
|
end
|
83
84
|
end
|
84
85
|
end
|
85
|
-
|
86
|
+
|
86
87
|
describe 'valid' do
|
87
88
|
[
|
88
89
|
'p@ssw0fdsafsdafrd',
|
@@ -98,7 +99,7 @@ module ActiveModel
|
|
98
99
|
end
|
99
100
|
end
|
100
101
|
end
|
101
|
-
|
102
|
+
|
102
103
|
describe 'entropy override' do
|
103
104
|
describe 'lowered entropy' do
|
104
105
|
describe 'valid' do
|
@@ -116,7 +117,7 @@ module ActiveModel
|
|
116
117
|
end
|
117
118
|
end
|
118
119
|
end
|
119
|
-
|
120
|
+
|
120
121
|
describe 'increased entropy' do
|
121
122
|
describe 'valid' do
|
122
123
|
[
|
@@ -134,7 +135,7 @@ module ActiveModel
|
|
134
135
|
end
|
135
136
|
end
|
136
137
|
end
|
137
|
-
|
138
|
+
|
138
139
|
describe 'extra words' do
|
139
140
|
it 'allows extra words to be specified as an option to the validation' do
|
140
141
|
password = 'mcmanus'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_password
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian McManus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|