##// END OF EJS Templates
Code cleanup....
Jean-Philippe Lang -
r10992:5741d007f660
parent child
Show More
@@ -353,14 +353,17 class User < Principal
353 # Find a user account by matching the exact login and then a case-insensitive
353 # Find a user account by matching the exact login and then a case-insensitive
354 # version. Exact matches will be given priority.
354 # version. Exact matches will be given priority.
355 def self.find_by_login(login)
355 def self.find_by_login(login)
356 if login.present?
357 login = login.to_s
356 # First look for an exact match
358 # First look for an exact match
357 user = where(:login => login).all.detect {|u| u.login == login}
359 user = where(:login => login).all.detect {|u| u.login == login}
358 unless user
360 unless user
359 # Fail over to case-insensitive if none was found
361 # Fail over to case-insensitive if none was found
360 user = where("LOWER(login) = ?", login.to_s.downcase).first
362 user = where("LOWER(login) = ?", login.downcase).first
361 end
363 end
362 user
364 user
363 end
365 end
366 end
364
367
365 def self.find_by_rss_key(key)
368 def self.find_by_rss_key(key)
366 token = Token.find_by_action_and_value('feeds', key.to_s)
369 token = Token.find_by_action_and_value('feeds', key.to_s)
General Comments 0
You need to be logged in to leave comments. Login now