Sha256: 44d32498ea61cb4348594252c6dfb31b9032fa24d325701ff264ce277ea03786
Contents?: true
Size: 637 Bytes
Versions: 9
Compression:
Stored size: 637 Bytes
Contents
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? result = nil 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 if authorization result = authorization.user end end result end end end
Version data entries
9 entries across 9 versions & 1 rubygems