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, #resource_params, #signed_in_resource

Instance Method Details

#createObject

POST /resource/sign_in



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

def create
  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



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

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

  # 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

#newObject

GET /resource/sign_in



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

def new
  resource = build_resource(nil, :unsafe => true)
  clean_up_passwords(resource)
  respond_with(resource, serialize_options(resource))
end