1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Merge pull request #2444 from julp/no_ghost_transactions

Fix empty transactions created by devise
This commit is contained in:
José Valim 2013-05-29 16:50:41 -07:00
commit 2ead747be6
2 changed files with 2 additions and 2 deletions

View file

@ -2,6 +2,6 @@
# This is only triggered when the user is explicitly set (with set_user) # This is only triggered when the user is explicitly set (with set_user)
Warden::Manager.after_set_user :except => :fetch do |record, warden, options| Warden::Manager.after_set_user :except => :fetch do |record, warden, options|
if record.respond_to?(:failed_attempts) && warden.authenticated?(options[:scope]) if record.respond_to?(:failed_attempts) && warden.authenticated?(options[:scope])
record.update_attribute(:failed_attempts, 0) record.update_attribute(:failed_attempts, 0) unless record.failed_attempts.zero?
end end
end end

View file

@ -50,7 +50,7 @@ module Devise
def remember_me!(extend_period=false) def remember_me!(extend_period=false)
self.remember_token = self.class.remember_token if generate_remember_token? self.remember_token = self.class.remember_token if generate_remember_token?
self.remember_created_at = Time.now.utc if generate_remember_timestamp?(extend_period) self.remember_created_at = Time.now.utc if generate_remember_timestamp?(extend_period)
save(:validate => false) save(:validate => false) if self.changed?
end end
# If the record is persisted, remove the remember token (but only if # If the record is persisted, remove the remember token (but only if