class Omnipass::Authenticate

Public Class Methods

build( omni_hash ) click to toggle source

instantiate OmniauthSession with the controller env

# File lib/omnipass/authenticate.rb, line 15
def self.build( omni_hash )
  self.new omni_hash.slice("provider", "uid", "info", "credentials")
end

Public Instance Methods

account() click to toggle source

DEPRECATED def user

@user ||= User.where(email: email).first_or_initialize

end

# File lib/omnipass/authenticate.rb, line 43
def account
  @account ||= Account.where(email: email).first_or_initialize
end
authentication() click to toggle source
# File lib/omnipass/authenticate.rb, line 33
def authentication
  @authentication ||= Users::Authentication.
    where(attributes.slice(:provider, :uid)).first_or_create
end
email() click to toggle source
# File lib/omnipass/authenticate.rb, line 19
def email
  info.fetch("email") { "nomail" }
end
save() click to toggle source
# File lib/omnipass/authenticate.rb, line 23
def save
  link_or_create_account
  authentication.transaction do
    saved = authentication.save
    # user.create_account
    # binding.pry
    saved
  end
end

Private Instance Methods