lib/devise/models/authenticatable.rb in devise-1.0.0 vs lib/devise/models/authenticatable.rb in devise-1.0.1

- old
+ new

@@ -1,7 +1,6 @@ require 'devise/strategies/authenticatable' -require 'devise/strategies/http_authenticatable' module Devise module Models # Authenticable Module, responsible for encrypting password and validating # authenticity of a user while signing in. @@ -85,15 +84,16 @@ ActiveSupport::Deprecation.warn "old_password is deprecated, please use current_password instead", caller end params.delete(:password) if params[:password].blank? params.delete(:password_confirmation) if params[:password_confirmation].blank? + current_password = params.delete(:current_password) - result = if valid_password?(params[:current_password]) + result = if valid_password?(current_password) update_attributes(params) else - message = params[:current_password].blank? ? :blank : :invalid + message = current_password.blank? ? :blank : :invalid self.class.add_error_on(self, :current_password, message, false) self.attributes = params false end @@ -118,15 +118,10 @@ conditions = attributes.slice(*authentication_keys) resource = find_for_authentication(conditions) resource if resource.try(:valid_for_authentication?, attributes) end - # Authenticate an user using http. - def authenticate_with_http(username, password) - authenticate(authentication_keys.first => username, :password => password) - end - # Returns the class for the configured encryptor. def encryptor_class @encryptor_class ||= ::Devise::Encryptors.const_get(encryptor.to_s.classify) end @@ -143,10 +138,9 @@ # end # def find_for_authentication(conditions) find(:first, :conditions => conditions) end - end end end end