Class: Devise::SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Devise::SessionsController
- Includes:
- Controllers::InternalHelpers
- Defined in:
- app/controllers/devise/sessions_controller.rb
Constant Summary
Constants included from Controllers::SharedHelpers
Controllers::SharedHelpers::MIME_REFERENCES
Instance Method Summary collapse
-
#create ⇒ Object
POST /resource/sign_in.
-
#destroy ⇒ Object
DELETE /resource/sign_out.
-
#new ⇒ Object
GET /resource/sign_in.
Methods included from Controllers::InternalHelpers
#devise_controller?, #devise_mapping, #resource, #resource_class, #resource_name, #signed_in_resource
Instance Method Details
#create ⇒ Object
POST /resource/sign_in
14 15 16 17 18 19 |
# File 'app/controllers/devise/sessions_controller.rb', line 14 def create resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new") (:notice, :signed_in) if sign_in(resource_name, resource) respond_with resource, :location => after_sign_in_path_for(resource) end |
#destroy ⇒ Object
DELETE /resource/sign_out
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/devise/sessions_controller.rb', line 22 def destroy signed_in = signed_in?(resource_name) redirect_path = after_sign_out_path_for(resource_name) Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name) :notice, :signed_out if signed_in # 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(*) { redirect_to redirect_path } format.all do method = "to_#{request_format}" text = {}.respond_to?(method) ? {}.send(method) : "" render :text => text, :status => :ok end end end |
#new ⇒ Object
GET /resource/sign_in
7 8 9 10 11 |
# File 'app/controllers/devise/sessions_controller.rb', line 7 def new resource = build_resource clean_up_passwords(resource) (resource, (resource)){ render_with_scope :new } end |