avoids conflicts with users using email as username
This commit is contained in:
@@ -292,7 +292,8 @@ class User < ActiveRecord::Base
|
||||
def self.find_for_database_authentication(warden_conditions)
|
||||
conditions = warden_conditions.dup
|
||||
if login = conditions.delete(:login)
|
||||
where(conditions.to_hash).where(["lower(email) = ? OR username = ?", login.downcase, login]).first
|
||||
where(conditions.to_hash).where(["lower(email) = ?", login.downcase]).first ||
|
||||
where(conditions.to_hash).where(["username = ?", login]).first
|
||||
elsif conditions.has_key?(:username) || conditions.has_key?(:email)
|
||||
where(conditions.to_hash).first
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user