Class: Kraut::SessionsController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/kraut/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/kraut/sessions_controller.rb', line 11

def create
  @session = Kraut::Session.new params[:kraut_session]

  authenticate_application
  if @session.valid?
    switch_user(@session)
    redirect_to stored_location! || Kraut::Rails::Engine.config.entry_url
  else
    render :new
  end
end

#destroyObject



23
24
25
26
# File 'app/controllers/kraut/sessions_controller.rb', line 23

def destroy
  reset_session
  redirect_to Kraut::Rails::Engine.config.entry_url
end

#newObject



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

def new
  @session = Kraut::Session.new
end