valid8ors 0.0.8 → 0.0.9
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.
- data/README.md +1 -1
- data/lib/valid8ors/password_strength.rb +2 -2
- data/test/password_strength_test.rb +1 -1
- data/valid8ors.gemspec +1 -1
- metadata +6 -6
data/README.md
CHANGED
@@ -115,7 +115,7 @@ You can translate (or overload) the default message via for e.g. (in english): "
|
|
115
115
|
|
116
116
|
## Password Strength Validator
|
117
117
|
|
118
|
-
Check if a password contains at least a
|
118
|
+
Check if a password contains at least a digit, lowercase and uppercase letter.
|
119
119
|
Password length validation is not included here as you can use Rails' builtin "LengthValidator".
|
120
120
|
|
121
121
|
### Usage
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class PasswordStrengthValidator < ActiveModel::EachValidator
|
4
4
|
|
5
|
-
#
|
5
|
+
# Password must contain at least a digit, lowercase and uppercase letter.
|
6
6
|
PASSWORD_PATTERN = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$/
|
7
7
|
|
8
8
|
def validate_each(record, attribute, value)
|
@@ -20,7 +20,7 @@ class PasswordStrengthValidator < ActiveModel::EachValidator
|
|
20
20
|
def invalid_message(record, attribute)
|
21
21
|
I18n.t :insecure,
|
22
22
|
scope: "#{record.class.i18n_scope}.errors.models.#{record.class.model_name.i18n_key}.attributes.#{attribute}",
|
23
|
-
default: "is not strong enough"
|
23
|
+
default: "is not strong enough. It should contain at least a digit, lowercase and uppercase letter."
|
24
24
|
end
|
25
25
|
|
26
26
|
end
|
@@ -27,7 +27,7 @@ class TestPasswordFormatValidator < MiniTest::Unit::TestCase
|
|
27
27
|
def test_default_message_on_error
|
28
28
|
test_user = TestUser.new(password: "invalid_password")
|
29
29
|
refute test_user.valid?
|
30
|
-
assert test_user.errors[:password].include?("is not strong enough")
|
30
|
+
assert test_user.errors[:password].include?("is not strong enough. It should contain at least a digit, lowercase and uppercase letter.")
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_nil_password_when_allow_nil_option_is_not_set
|
data/valid8ors.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "valid8ors"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.9"
|
7
7
|
s.authors = ["Axel Vergult", "Vincent Pochet", "Ben Colon"]
|
8
8
|
s.email = ["axel@official.fm", "vincent@official.fm", "ben@official.fm"]
|
9
9
|
s.homepage = ""
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valid8ors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-07-
|
14
|
+
date: 2012-07-09 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activemodel
|
18
|
-
requirement: &
|
18
|
+
requirement: &70223479086520 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
version: '0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70223479086520
|
27
27
|
description: Rails 3 awesome custom validators
|
28
28
|
email:
|
29
29
|
- axel@official.fm
|
@@ -67,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
67
|
version: '0'
|
68
68
|
segments:
|
69
69
|
- 0
|
70
|
-
hash:
|
70
|
+
hash: -2283626172012641948
|
71
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
segments:
|
78
78
|
- 0
|
79
|
-
hash:
|
79
|
+
hash: -2283626172012641948
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
82
|
rubygems_version: 1.8.10
|