Class: Authenticate::SessionsController

Inherits:
AuthenticateController show all
Defined in:
app/controllers/authenticate/sessions_controller.rb

Overview

Allow authenticate users to log in and log out.

Instance Method Summary collapse

Instance Method Details

#createObject


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

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

#destroyObject


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

def destroy
  logout
  redirect_to url_after_destroy
end

#newObject


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

def new
  render template: 'sessions/new'
end