X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ce37f1ab6585ace95c43c2bd5b40e362cc985788..0f6d05a2d75f55a228ae6ab8c8c4d70ea063a8a2:/app/models/user.rb?ds=inline diff --git a/app/models/user.rb b/app/models/user.rb index 1261e5a18..c64fcf21b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -28,8 +28,8 @@ class User < ActiveRecord::Base write_attribute("pass_crypt_confirm", Digest::MD5.hexdigest(str)) end - def self.authenticate(email, passwd) - find(:first, :conditions => [ "email = ? AND pass_crypt = ?", email, Digest::MD5.hexdigest(passwd)]) + def self.authenticate(email, passwd) + find(:first, :conditions => [ "email = ? AND pass_crypt = ? AND active = true", email, Digest::MD5.hexdigest(passwd)]) end def self.authenticate_token(token) @@ -78,12 +78,12 @@ class User < ActiveRecord::Base end def get_new_messages - messages = Message.find(:all, :conditions => "message_read = 0") + messages = Message.find(:all, :conditions => "message_read = 0 and to_user_id = #{self.id}") return messages end def get_all_messages - messages = Message.find(:all, :conditions => "message_read = 0") + messages = Message.find(:all, :conditions => "to_user_id = #{self.id}") return messages end