@@ -353,13 +353,16 class User < Principal | |||
|
353 | 353 | # Find a user account by matching the exact login and then a case-insensitive |
|
354 | 354 | # version. Exact matches will be given priority. |
|
355 | 355 | def self.find_by_login(login) |
|
356 | # First look for an exact match | |
|
357 | user = where(:login => login).all.detect {|u| u.login == login} | |
|
358 | unless user | |
|
359 | # Fail over to case-insensitive if none was found | |
|
360 | user = where("LOWER(login) = ?", login.to_s.downcase).first | |
|
356 | if login.present? | |
|
357 | login = login.to_s | |
|
358 | # First look for an exact match | |
|
359 | user = where(:login => login).all.detect {|u| u.login == login} | |
|
360 | unless user | |
|
361 | # Fail over to case-insensitive if none was found | |
|
362 | user = where("LOWER(login) = ?", login.downcase).first | |
|
363 | end | |
|
364 | user | |
|
361 | 365 | end |
|
362 | user | |
|
363 | 366 | end |
|
364 | 367 | |
|
365 | 368 | def self.find_by_rss_key(key) |
General Comments 0
You need to be logged in to leave comments.
Login now