simple_user_auth 0.0.3 → 0.0.5

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.
@@ -1,3 +1,3 @@
1
1
  module SimpleUserAuth
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -45,12 +45,7 @@ module SimpleUserAuth
45
45
  module ClassInstanceMethods
46
46
 
47
47
  def change_password? #:nodoc:
48
- @change_password ||= false
49
- end
50
-
51
- # Set this to true to enable replacing encrypted_password with the password accessor. Also enables validations for passwords.
52
- def change_password=(bool)
53
- @change_password = bool
48
+ !password.blank?
54
49
  end
55
50
 
56
51
  # Checks to see if a user has a particular password
@@ -61,7 +56,7 @@ module SimpleUserAuth
61
56
  private
62
57
 
63
58
  def change_password_validator
64
- if change_password?
59
+ if change_password? && !new_record?
65
60
  errors.add(:old_password, "doesn't match.") unless has_password?(current_password)
66
61
  end
67
62
  end
@@ -100,7 +95,7 @@ module SimpleUserAuth
100
95
  end
101
96
 
102
97
  module ClassMethods
103
- # The user model you'll be using. This could be useful if there were different user models for different namespaces.
98
+ # The user model you'll be using.
104
99
  # e.g. can_sign_in :user
105
100
  def can_sign_in(model)
106
101
  klass = Kernel.const_get(model.to_s.camelize)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: simple_user_auth
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Erich Menge