Class: SessionsController

Inherits:
ApplicationController show all
Defined in:
lib/branston/app/controllers/sessions_controller.rb,
lib/branston/test/functional/sessions_controller_test.rb

Overview

Re-raise errors caught by the controller.

Instance Method Summary collapse

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/branston/app/controllers/sessions_controller.rb', line 24

def create
  logout_keeping_session!
  user = User.authenticate(params[:login], params[:password])
  if user
    # Protects against session fixation attacks, causes request forgery
    # protection if user resubmits an earlier form using back
    # button. Uncomment if you understand the tradeoffs.
    # reset_session
    self.current_user = user
    new_cookie_flag = (params[:remember_me] == "1")
    handle_remember_cookie! new_cookie_flag
    redirect_back_or_default('/')
    flash[:notice] = "Logged in successfully"
  else
    
    @login       = params[:login]
    @remember_me = params[:remember_me]
    render :action => 'new'
  end
end

#destroyObject



45
46
47
48
49
# File 'lib/branston/app/controllers/sessions_controller.rb', line 45

def destroy
  logout_killing_session!
  flash[:notice] = "You have been logged out."
  redirect_back_or_default('/')
end

#newObject

render new.rhtml



21
22
# File 'lib/branston/app/controllers/sessions_controller.rb', line 21

def new
end

#rescue_action(e) ⇒ Object



5
# File 'lib/branston/test/functional/sessions_controller_test.rb', line 5

def rescue_action(e) raise e end