X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/20e02f42dc5d946f4650c806531b09f793abf503..8b240b982b0c0c1f786054f0c472353cb2e85d10:/app/models/user.rb?ds=sidebyside diff --git a/app/models/user.rb b/app/models/user.rb index f72fd5bfa..ae0dbac54 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) @@ -62,7 +62,7 @@ class User < ActiveRecord::Base def nearby(lat_range=1, lon_range=1) if self.home_lon and self.home_lat - nearby = User.find(:all, :conditions => "#{self.home_lon} > home_lon - #{lon_range} and #{self.home_lon} < home_lon + #{lon_range} and #{self.home_lon} > home_lon - #{lon_range} and #{self.home_lon} < home_lon + #{lon_range} and data_public = 1 and id != #{self.id}") + nearby = User.find(:all, :conditions => "#{self.home_lon} > home_lon - #{lon_range} and #{self.home_lon} < home_lon + #{lon_range} and #{self.home_lat} > home_lat - #{lat_range} and #{self.home_lat} < home_lat + #{lat_range} and data_public = 1 and id != #{self.id}") else nearby = [] end