Class: Gemgento::User::SessionsController
- Inherits:
-
Devise::SessionsController
- Object
- Devise::SessionsController
- Gemgento::User::SessionsController
- Defined in:
- app/controllers/gemgento/user/sessions_controller.rb
Instance Method Summary collapse
-
#create {|resource| ... } ⇒ Object
POST /resource/sign_in.
-
#destroy ⇒ Object
DELETE /resource/sign_out.
Instance Method Details
#create {|resource| ... } ⇒ Object
POST /resource/sign_in
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/gemgento/user/sessions_controller.rb', line 7 def create self.resource = warden.authenticate!() (:notice, :signed_in) if is_flashing_format? sign_in(resource_name, resource) yield resource if block_given? respond_to do |format| format.html { respond_with resource, location: after_sign_in_path_for(resource) } format.json do render json: { result: true, user: resource, csrfParam: request_forgery_protection_token, csrfToken: form_authenticity_token } end end end |
#destroy ⇒ Object
DELETE /resource/sign_out
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/gemgento/user/sessions_controller.rb', line 27 def destroy redirect_path = after_sign_out_path_for(resource_name) signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)) :notice, :signed_out if signed_out && # reset the current quote when user logs out, the current quotes persists between user sessions. current_quote.reset unless current_quote.new_record? # 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(*) { redirect_to redirect_path } end end |