Clean up whitespace and remove deprecated stuff.

This commit is contained in:
José Valim 2010-01-13 18:23:04 +01:00
parent b581f86317
commit d4442837d5
4 changed files with 11 additions and 18 deletions

View File

@ -1,15 +1,15 @@
module Devise
module Models
autoload :Activatable, 'devise/models/activatable'
autoload :Authenticatable, 'devise/models/authenticatable'
autoload :Confirmable, 'devise/models/confirmable'
autoload :Recoverable, 'devise/models/recoverable'
autoload :Authenticatable, 'devise/models/authenticatable'
autoload :Confirmable, 'devise/models/confirmable'
autoload :Lockable, 'devise/models/lockable'
autoload :Recoverable, 'devise/models/recoverable'
autoload :Rememberable, 'devise/models/rememberable'
autoload :SessionSerializer, 'devise/models/session_serializer'
autoload :Timeoutable, 'devise/models/timeoutable'
autoload :Trackable, 'devise/models/trackable'
autoload :Validatable, 'devise/models/validatable'
autoload :Lockable, 'devise/models/lockable'
autoload :Timeoutable, 'devise/models/timeoutable'
autoload :Trackable, 'devise/models/trackable'
autoload :Validatable, 'devise/models/validatable'
# Creates configuration values for Devise and for the given module.
#

View File

@ -84,13 +84,7 @@ module Devise
return unless authentication_keys.all? { |k| attributes[k].present? }
conditions = attributes.slice(*authentication_keys)
resource = find_for_authentication(conditions)
if respond_to?(:valid_for_authentication)
ActiveSupport::Deprecation.warn "valid_for_authentication class method is deprecated. " <<
"Use valid_for_authentication? in the instance instead."
valid_for_authentication(resource, attributes)
elsif resource.try(:valid_for_authentication?, attributes)
resource
end
resource if resource.try(:valid_for_authentication?, attributes)
end
# Returns the class for the configured encryptor.

View File

@ -67,11 +67,11 @@ module Devise
# for verifying whether an user is allowed to sign in or not. If the user
# is locked, it should never be allowed.
def valid_for_authentication?(attributes)
unless result = super
if result = super
self.failed_attempts = 0
else
self.failed_attempts += 1
self.lock if self.failed_attempts > self.class.maximum_attempts
else
self.failed_attempts = 0
end
save(false) if changed?
result

View File

@ -2,7 +2,6 @@ require 'devise/hooks/timeoutable'
module Devise
module Models
# Timeoutable takes care of veryfing whether a user session has already
# expired or not. When a session expires after the configured time, the user
# will be asked for credentials again, it means, he/she will be redirected