Class: SessionsController
- Inherits:
-
Devise::SessionsController
- Object
- Devise::SessionsController
- SessionsController
- Defined in:
- app/controllers/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 |
# File 'app/controllers/sessions_controller.rb', line 7 def create resource = warden.authenticate!() (:notice, :signed_in) if sign_in(resource_name, resource) redirect_to after_sign_in_path_for(resource) end |
#destroy ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/sessions_controller.rb', line 14 def destroy signed_in = signed_in?(resource_name) redirect_url = after_sign_out_path_for(resource_name) || root_url if redirect_url.match(/^\/$/) redirect_url = root_url end 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 "https://#{User.wind_host}/logout?passthrough=1&destination=" + redirect_url } format.all do method = "to_#{request_format}" text = {}.respond_to?(method) ? {}.send(method) : "" render :text => text, :status => :ok end end end |
#new ⇒ Object
3 4 5 |
# File 'app/controllers/sessions_controller.rb', line 3 def new create end |