Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11222 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
e355a55e3c
commit
5741d007f6
|
@ -353,14 +353,17 @@ class User < Principal
|
||||||
# Find a user account by matching the exact login and then a case-insensitive
|
# Find a user account by matching the exact login and then a case-insensitive
|
||||||
# version. Exact matches will be given priority.
|
# version. Exact matches will be given priority.
|
||||||
def self.find_by_login(login)
|
def self.find_by_login(login)
|
||||||
|
if login.present?
|
||||||
|
login = login.to_s
|
||||||
# First look for an exact match
|
# First look for an exact match
|
||||||
user = where(:login => login).all.detect {|u| u.login == login}
|
user = where(:login => login).all.detect {|u| u.login == login}
|
||||||
unless user
|
unless user
|
||||||
# Fail over to case-insensitive if none was found
|
# Fail over to case-insensitive if none was found
|
||||||
user = where("LOWER(login) = ?", login.to_s.downcase).first
|
user = where("LOWER(login) = ?", login.downcase).first
|
||||||
end
|
end
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.find_by_rss_key(key)
|
def self.find_by_rss_key(key)
|
||||||
token = Token.find_by_action_and_value('feeds', key.to_s)
|
token = Token.find_by_action_and_value('feeds', key.to_s)
|
||||||
|
|
Loading…
Reference in New Issue