Class: Clearance::SessionsController

Inherits:
BaseController show all
Defined in:
app/controllers/clearance/sessions_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#show

Methods included from Authorization

#authorize, #deny_access

Methods included from Authentication

#authenticate, #current_user, #current_user=, #handle_unverified_request, #sign_in, #sign_out, #signed_in?, #signed_out?

Instance Method Details

#createObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/clearance/sessions_controller.rb', line 5

def create
  @user = authenticate(params)

  (@user) do |status|
    if status.success?
      redirect_back_or url_after_create
    else
      flash.now.notice = status.failure_message
      render template: 'sessions/new', status: :unauthorized
    end
  end
end

#destroyObject



18
19
20
21
# File 'app/controllers/clearance/sessions_controller.rb', line 18

def destroy
  sign_out
  redirect_to url_after_destroy
end

#newObject



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

def new
  render template: 'sessions/new'
end