Class: Mori::SessionsController

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

Overview

Mori::SessionsController is responsible for creating and destroying sessions

Instance Method Summary collapse

Methods inherited from BaseController

#mori_config, #set_token

Instance Method Details

#createObject



13
14
15
16
# File 'app/controllers/mori/sessions_controller.rb', line 13

def create
  warden.authenticate!
  redirect_to @config.dashboard_path, :notice => 'You have logged in'
end

#destroyObject



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

def destroy
  warden.logout
  redirect_to @config.after_logout_path
end

#newObject



3
4
5
6
7
8
9
10
11
# File 'app/controllers/mori/sessions_controller.rb', line 3

def new
  if current_user
    redirect_to @config.dashboard_path
  else
    @user = @config.user_model.new
    flash.now.alert = warden.message
    render :template => 'sessions/new'
  end
end