user_rb.patch

Patch file for user.rb generated by TortoiseSVN 1.5.6 - Teddy L, 2009-01-08 21:24

Download (1.56 KB)

View differences:

user.rb (working copy)
53 53
  attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
54 54
	
55 55
  validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
56
  validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }
57
  validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }
56
  validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }, :case_sensitive => false
57
  validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }, :case_sensitive => false
58 58
  # Login must contain lettres, numbers, underscores only
59 59
  validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
60 60
  validates_length_of :login, :maximum => 30
......
84 84
  def self.try_to_login(login, password)
85 85
    # Make sure no one can sign in with an empty password
86 86
    return nil if password.to_s.empty?
87
    user = find(:first, :conditions => ["login=?", login])
87
    user = find_by_login(login)
88 88
    if user
89 89
      # user is already in local database
90 90
      return nil if !user.active?
......
183 183
  def self.find_by_mail(mail)
184 184
    find(:first, :conditions => ["LOWER(mail) = ?", mail.to_s.downcase])
185 185
  end
186
  
187
  # Makes find_by_login case-insensitive
188
  def self.find_by_login(login)
189
    find(:first, :conditions => ["LOWER(login) = ?", login.to_s.downcase])
190
  end
186 191

  
187 192
  # Sort users by their display names
188 193
  def <=>(user)