Class: SessionsController
- Inherits:
-
Devise::SessionsController
- Object
- Devise::SessionsController
- SessionsController
- Defined in:
- lib/forge/app/controllers/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/forge/app/controllers/sessions_controller.rb', line 8 def create resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new") if resource.approved? sign_in(resource_name, resource) respond_with resource, :location => after_sign_in_path_for(resource) else Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name) :warning, :not_approved redirect_to "/login" end end |
#destroy ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/forge/app/controllers/sessions_controller.rb', line 20 def destroy signed_in = signed_in?(resource_name) Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name) :notice, :signed_out if signed_in respond_to do |format| format.any(*) { redirect_to "/login" } format.all do method = "to_#{request_format}" text = {}.respond_to?(method) ? {}.send(method) : "" render :text => text, :status => :ok end end end |
#new ⇒ Object
2 3 4 5 6 |
# File 'lib/forge/app/controllers/sessions_controller.rb', line 2 def new self.resource = resource_class.new(sign_in_params) clean_up_passwords(resource) render :template => "devise/sessions/new" end |