Class: Devise::SessionsController

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

Instance Method Summary collapse

Methods inherited from DeviseController

#_prefixes, #devise_mapping, #resource, #resource_class, #resource_name, #signed_in_resource

Instance Method Details

#createObject

POST /resource/sign_in



14
15
16
17
18
19
# File 'app/controllers/devise/sessions_controller.rb', line 14

def create
  self.resource = warden.authenticate!(auth_options)
  set_flash_message(:notice, :signed_in) if is_navigational_format?
  (resource_name, resource)
  respond_with resource, :location => (resource)
end

#destroyObject

DELETE /resource/sign_out



22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/devise/sessions_controller.rb', line 22

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 :notice, :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.all { head :no_content }
    format.any(*navigational_formats) { redirect_to redirect_path }
  end
end

#newObject

GET /resource/sign_in



7
8
9
10
11
# File 'app/controllers/devise/sessions_controller.rb', line 7

def new
  self.resource = resource_class.new()
  clean_up_passwords(resource)
  respond_with(resource, serialize_options(resource))
end