Class: Booth::Sessions::CreateAndLogin

Inherits:
Object
  • Object
show all
Includes:
Logging, MethodObject
Defined in:
lib/booth/sessions/create_and_login.rb

Instance Method Summary collapse

Methods included from MethodObject

included

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/booth/sessions/create_and_login.rb', line 10

def call
  if request.scope != credential.scope.to_sym
    debug { "Request has scope #{request.scope.inspect} but Credential has #{credential.scope.to_sym.inspect}" }
    raise 'Not performing login because something in your setup is wrong.'
  end

  request.authentication
         .(session: create_session)

  # Consume everything that led up to this authentication to avoid re-authentication.
  # If we don't reset the cookie here, the "remote login flow" could log you right back in.
  .reset
  registration_storage.reset

  Tron.success :session_created_and_logged_in, return_path: request.return_path
end