Method: Virgo::User.find_first_by_auth_conditions

Defined in:
app/models/virgo/user.rb

.find_first_by_auth_conditions(warden_conditions) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
# File 'app/models/virgo/user.rb', line 107

def self.find_first_by_auth_conditions(warden_conditions)
  conditions = warden_conditions.dup
  if  = conditions.delete(:login)
    where(conditions).where(["lower(username) = :value OR lower(email) = :value", { :value => .downcase }]).first
  else
    if conditions[:username].nil?
      where(conditions).first
    else
      where(username: conditions[:username]).first
    end
  end
end