Class: SessionsController

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

Instance Attribute Summary

Attributes included from PagesCore::Authentication

#current_user

Instance Method Summary collapse

Methods included from PagesCore::StaticCacheController

#disable_static_cache!

Methods included from PagesCore::PoliciesHelper

#policy, #verify_policy, #verify_policy_with_proc

Methods included from PagesCore::ProcessTitler

inc_number_of_requests, original_title

Methods included from PagesCore::ErrorRenderer

#render_error

Methods included from PagesCore::Authentication

#authenticate!, #deauthenticate!, #logged_in?

Instance Method Details

#createObject



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

def create
  user = find_user(params[:username], params[:password])
  authenticate!(user) if user

  if logged_in?
    redirect_to admin_default_url
  else
    flash[:notice] = "The provided email address and password combination " \
      "was not valid"
    redirect_to 
  end
end

#destroyObject



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

def destroy
  flash[:notice] = "You have been logged out"
  deauthenticate!
  redirect_to 
end