Sha256: fd06d588ef1d6c486f11d7c4a8e87d4632c2ec0c948b8dfccce53b7b3f5bf0cb
Contents?: true
Size: 743 Bytes
Versions: 2
Compression:
Stored size: 743 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 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
challah-1.1.1 | lib/challah/user/finders.rb |
challah-1.1.0 | lib/challah/user/finders.rb |