Class: Devise::SessionsController
- Inherits:
-
DeviseController
- Object
- DeviseController
- Devise::SessionsController
- Defined in:
- app/controllers/devise/sessions_controller.rb
Instance Method Summary collapse
- #auth_options ⇒ Object protected
-
#create {|resource| ... } ⇒ Object
POST /resource/sign_in.
-
#destroy ⇒ Object
DELETE /resource/sign_out.
-
#new {|resource| ... } ⇒ Object
GET /resource/sign_in.
- #serialize_options(resource) ⇒ Object protected
- #sign_in_params ⇒ Object protected
- #translation_scope ⇒ Object protected
Instance Method Details
#auth_options ⇒ Object (protected)
47 48 49 |
# File 'app/controllers/devise/sessions_controller.rb', line 47 def { scope: resource_name, recall: "#{controller_path}#new", locale: I18n.locale } end |
#create {|resource| ... } ⇒ Object
POST /resource/sign_in
18 19 20 21 22 23 24 |
# File 'app/controllers/devise/sessions_controller.rb', line 18 def create self.resource = warden.authenticate!() (:notice, :signed_in) sign_in(resource_name, resource) yield resource if block_given? respond_with resource, location: after_sign_in_path_for(resource) end |
#destroy ⇒ Object
DELETE /resource/sign_out
27 28 29 30 31 32 |
# File 'app/controllers/devise/sessions_controller.rb', line 27 def destroy signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)) :notice, :signed_out if signed_out yield if block_given? respond_to_on_destroy end |
#new {|resource| ... } ⇒ Object
GET /resource/sign_in
10 11 12 13 14 15 |
# File 'app/controllers/devise/sessions_controller.rb', line 10 def new self.resource = resource_class.new(sign_in_params) clean_up_passwords(resource) yield resource if block_given? respond_with(resource, (resource)) end |
#serialize_options(resource) ⇒ Object (protected)
40 41 42 43 44 45 |
# File 'app/controllers/devise/sessions_controller.rb', line 40 def (resource) methods = resource_class.authentication_keys.dup methods = methods.keys if methods.is_a?(Hash) methods << :password if resource.respond_to?(:password) { methods: methods, only: [:password] } end |
#sign_in_params ⇒ Object (protected)
36 37 38 |
# File 'app/controllers/devise/sessions_controller.rb', line 36 def sign_in_params devise_parameter_sanitizer.sanitize(:sign_in) end |
#translation_scope ⇒ Object (protected)
51 52 53 |
# File 'app/controllers/devise/sessions_controller.rb', line 51 def translation_scope 'devise.sessions' end |