Class: NoPassword::SessionsController

Inherits:
ApplicationController show all
Includes:
ControllerHelpers
Defined in:
app/controllers/no_password/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/no_password/sessions_controller.rb', line 12

def create
  return_to = params[:return_to].to_s
  current_session = SessionManager.new.create(request.user_agent, params.dig(:session, :email), request.remote_ip, referrer_path(return_to))

  if current_session.present?
    SessionsMailer.with(session: current_session).send_token.deliver_later

    after_session_request if respond_to?(:after_session_request)

    respond_to do |format|
      format.html { redirect_to no_password.edit_session_confirmations_path }
      format.turbo_stream
    end
  end
end

#destroyObject



28
29
30
31
# File 'app/controllers/no_password/sessions_controller.rb', line 28

def destroy
  sign_out
  redirect_to main_app.root_path
end

#newObject



7
8
9
10
# File 'app/controllers/no_password/sessions_controller.rb', line 7

def new
  @return_to = params[:return_to].to_s
  @resource = Session.new
end