lib/challah/user/finders.rb in challah-1.0.0 vs lib/challah/user/finders.rb in challah-1.1.0
- old
+ new
@@ -1,6 +1,7 @@
module Challah::User
+
module Finders
# Find a user instance by username first, or email address if needed.
# If no user is found matching, return nil
def find_for_session(username_or_email)
return nil if username_or_email.to_s.blank?
@@ -10,16 +11,21 @@
if username_or_email.to_s.include?('@')
result = where(email: username_or_email).first
end
if !result
- authorization = ::Authorization.where(provider: :password, uid: username_or_email.to_s.downcase.strip).first
+ uid = username_or_email.to_s.downcase.strip
+ authorization = self.authorization_model
+ authorization = authorization.where(provider: :password, uid: uid)
+ authorization = authorization.first
+
if authorization
result = authorization.user
end
end
result
end
end
+
end
\ No newline at end of file