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
@@ -39,3 +39,7 @@
39
39
  * Increased required password length to 6 characters
40
40
  * Added support for custom validators
41
41
  * Added Windows 2008 validator
42
+
43
+ == 0.3.1 - August 12 2010
44
+
45
+ * The enabled option was ignored in some cases.
@@ -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 PasswordStrength.enabled && strength.valid?(options[:level])
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])
@@ -2,7 +2,7 @@ module PasswordStrength
2
2
  module Version # :nodoc: all
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -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.0
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-11 00:00:00 -03:00
12
+ date: 2010-08-12 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency