Class: Clearance::SessionsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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



20
21
22
23
# File 'app/controllers/clearance/sessions_controller.rb', line 20

def destroy
  sign_out
  redirect_to url_after_destroy
end

#newObject



25
26
27
# File 'app/controllers/clearance/sessions_controller.rb', line 25

def new
  render template: "sessions/new"
end