password_strength 0.3.0 → 0.3.1
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/CHANGELOG.rdoc
CHANGED
@@ -45,9 +45,11 @@ module PasswordStrength
|
|
45
45
|
raise ArgumentError, "The :level option must be one of [:weak, :good, :strong]" unless [:weak, :good, :strong].include?(options[:level])
|
46
46
|
|
47
47
|
validates_each(attr_names, options) do |record, attr_name, value|
|
48
|
+
next unless PasswordStrength.enabled
|
49
|
+
|
48
50
|
strength = options[:using].new(record.send(options[:with]), value, :exclude => options[:exclude])
|
49
51
|
strength.test
|
50
|
-
record.errors.add(attr_name, :too_weak, options) unless
|
52
|
+
record.errors.add(attr_name, :too_weak, options) unless strength.valid?(options[:level])
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
@@ -6,6 +6,7 @@ module ActiveModel # :nodoc:
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def validate_each(record, attribute, value)
|
9
|
+
return unless PasswordStrength.enabled
|
9
10
|
strength = options[:using].new(record.send(options[:with]), value, :exclude => options[:exclude])
|
10
11
|
strength.test
|
11
12
|
record.errors.add(attribute, :too_weak, options) unless PasswordStrength.enabled && strength.valid?(options[:level])
|
data/test/active_record_test.rb
CHANGED
@@ -76,6 +76,7 @@ class TestActiveRecord < Test::Unit::TestCase
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_ignore_validations_when_password_strength_is_disabled
|
79
|
+
User.validates_strength_of :password
|
79
80
|
PasswordStrength.enabled = false
|
80
81
|
@user.update_attributes :password => ""
|
81
82
|
assert @user.valid?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: password_strength
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-08-
|
12
|
+
date: 2010-08-12 00:00:00 -03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|