Class: Carnival::SessionsController

Inherits:
Devise::SessionsController
  • Object
show all
Defined in:
app/controllers/carnival/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



4
5
6
7
8
# File 'app/controllers/carnival/sessions_controller.rb', line 4

def create
  resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
  set_flash_message(:success, :signed_in) if is_navigational_format?
  redirect_to admin_root_url
end

#destroyObject



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

def destroy
  redirect_path = after_sign_out_path_for(resource_name)
  signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))
  set_flash_message :success, :signed_out if signed_out && is_navigational_format?
  # We actually need to hardcode this as Rails default responder doesn't
  # support returning empty response on GET request
  respond_to do |format|
    format.any(*navigational_formats) { redirect_to redirect_path }
    format.all do
      head :no_content
    end
  end
end