X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0d597c1771dce91ee2880ef946f5a9976c6e10d1..c11d961f624cb610c4b8184d24e522b2c093d1ea:/app/models/user.rb diff --git a/app/models/user.rb b/app/models/user.rb index d6cff0f25..92d47d5ff 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -24,11 +24,11 @@ class User < ActiveRecord::Base end def encrypt_password - self.pass_crypt = Digest::MD5.hexdigest(pass_crypt) if pass_crypt_confirmation + self.pass_crypt = Digest::MD5.hexdigest(pass_crypt) unless pass_crypt_confirmation.nil? end - def self.authenticate(email, passwd) - find(:first, :conditions => [ "email = ? AND pass_crypt = ? AND active = true", email, Digest::MD5.hexdigest(passwd)]) + def self.authenticate(email, passwd, active = true) + find(:first, :conditions => [ "email = ? AND pass_crypt = ? AND active = ?", email, Digest::MD5.hexdigest(passwd), active]) end def self.authenticate_token(token)