thincloud-authentication 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,7 @@ module Thincloud::Authentication
13
13
  # Ensure that a `verification_token` exists for new records.
14
14
  after_initialize do
15
15
  self.verification_token = SecureRandom.urlsafe_base64 if new_record?
16
+ self.resetting_identity_password = false
16
17
  end
17
18
 
18
19
  # Only validate password if the 'provider' is 'identity'.
@@ -89,7 +90,7 @@ module Thincloud::Authentication
89
90
  def generate_password_reset!
90
91
  self.password_reset_token = SecureRandom.urlsafe_base64
91
92
  self.password_reset_sent_at = Time.zone.now
92
- save!
93
+ save_with_identity_password_reset!
93
94
  end
94
95
 
95
96
  # Public: Clear password reset fields, reset password_required? requirement
@@ -114,7 +115,9 @@ module Thincloud::Authentication
114
115
  #
115
116
  # Returns: true or false
116
117
  def password_required?
117
- identity_provider? && (new_record? || password_reset_token.present?)
118
+ (identity_provider? && check_identity_password?) && (
119
+ new_record? || password_reset_token.present?
120
+ )
118
121
  end
119
122
 
120
123
  # Public: Determine if the password confirmation must be provided
@@ -125,5 +128,21 @@ module Thincloud::Authentication
125
128
  password.present? || password_confirmation.present?
126
129
  )
127
130
  end
131
+
132
+ private
133
+
134
+ attr_accessor :resetting_identity_password
135
+
136
+ def check_identity_password?
137
+ !resetting_identity_password
138
+ end
139
+
140
+ def save_with_identity_password_reset!
141
+ self.resetting_identity_password = true
142
+ save!
143
+ ensure
144
+ self.resetting_identity_password = false
145
+ end
146
+
128
147
  end
129
148
  end
@@ -1,5 +1,5 @@
1
1
  module Thincloud
2
2
  module Authentication
3
- VERSION = "0.6.3"
3
+ VERSION = "0.6.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thincloud-authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-21 00:00:00.000000000 Z
13
+ date: 2013-06-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -150,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  segments:
152
152
  - 0
153
- hash: -4365408844162385494
153
+ hash: -688498285375769564
154
154
  required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  none: false
156
156
  requirements:
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  segments:
161
161
  - 0
162
- hash: -4365408844162385494
162
+ hash: -688498285375769564
163
163
  requirements: []
164
164
  rubyforge_project:
165
165
  rubygems_version: 1.8.23