@@ -353,14 +353,17 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 | if login.present? | |
|
357 | login = login.to_s | |
|
356 | 358 | # First look for an exact match |
|
357 | 359 | user = where(:login => login).all.detect {|u| u.login == login} |
|
358 | 360 | unless user |
|
359 | 361 | # Fail over to case-insensitive if none was found |
|
360 |
user = where("LOWER(login) = ?", login. |
|
|
362 | user = where("LOWER(login) = ?", login.downcase).first | |
|
361 | 363 | end |
|
362 | 364 | user |
|
363 | 365 | end |
|
366 | end | |
|
364 | 367 | |
|
365 | 368 | def self.find_by_rss_key(key) |
|
366 | 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