@@ -225,10 +225,13 class User < Principal | |||
|
225 | 225 | # Find a user account by matching the exact login and then a case-insensitive |
|
226 | 226 | # version. Exact matches will be given priority. |
|
227 | 227 | def self.find_by_login(login) |
|
228 | # force string comparison to be case sensitive on MySQL | |
|
229 | type_cast = (ActiveRecord::Base.connection.adapter_name == 'MySQL') ? 'BINARY' : '' | |
|
230 | ||
|
228 | 231 | # First look for an exact match |
|
229 |
user = first(:conditions => |
|
|
232 | user = first(:conditions => ["#{type_cast} login = ?", login]) | |
|
230 | 233 | # Fail over to case-insensitive if none was found |
|
231 | user ||= first(:conditions => ["LOWER(login) = ?", login.to_s.downcase]) | |
|
234 | user ||= first(:conditions => ["#{type_cast} LOWER(login) = ?", login.to_s.downcase]) | |
|
232 | 235 | end |
|
233 | 236 | |
|
234 | 237 | def self.find_by_rss_key(key) |
General Comments 0
You need to be logged in to leave comments.
Login now