Class: Manifest::SessionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/manifest/sessions_controller.rb

Overview

Creates or destroys Editor sessions.

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  editor = Editor.find_by_email(params[:email])

  if editor && editor.authenticate(params[:password])
    session[:editor_id] = editor.id
    redirect_to manifest_path, notice: 'Logged in!'
  else
    flash.now.alert = 'Email or password is invalid'
    render 'new'
  end
end

#destroyObject



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

def destroy
  session[:editor_id] = nil
  redirect_to new_manifest_session_path
end

#newObject



5
6
# File 'app/controllers/manifest/sessions_controller.rb', line 5

def new
end