##// END OF EJS Templates
Refactor and documentation for User#find_by_login....
Eric Davis -
r3694:6cb4ff7d8981
parent child
Show More
@@ -221,14 +221,14 class User < Principal
221 221 @notified_projects_ids = nil
222 222 notified_projects_ids
223 223 end
224
225 # case-insensitive fall-over
224
225 # Find a user account by matching the exact login and then a case-insensitive
226 # version. Exact matches will be given priority.
226 227 def self.find_by_login(login)
227 228 # First look for an exact match
228 user = find(:first, :conditions => ["login = ?", login])
229 user = first(:conditions => {:login => login})
229 230 # Fail over to case-insensitive if none was found
230 user = find(:first, :conditions => ["LOWER(login) = ?", login.to_s.downcase]) if user.nil?
231 return user
231 user ||= first(:conditions => ["LOWER(login) = ?", login.to_s.downcase])
232 232 end
233 233
234 234 def self.find_by_rss_key(key)
General Comments 0
You need to be logged in to leave comments. Login now