Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 34 lines (29 sloc) 1.197 kB
02e8c04 @josevalim Update views generator and now have scoped views.
josevalim authored
1 class Devise::SessionsController < ApplicationController
a5ba2ac @carlosantoniodasilva Use prepend_before_filter in require_no_authentication.
carlosantoniodasilva authored
2 prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
b581f86 @josevalim DRY up controllers.
josevalim authored
3 include Devise::Controllers::InternalHelpers
dede8af @josevalim Do not include Devise internal helpers in application controller.
josevalim authored
4
b21b629 @carlosantoniodasilva Better documentation.
carlosantoniodasilva authored
5 # GET /resource/sign_in
7ce49cb @carlosantoniodasilva Configuring session and password controllers as engine, and getting i…
carlosantoniodasilva authored
6 def new
2b5a068 @josevalim Move part of the logic in SessionsController#create to the FailureApp…
josevalim authored
7 clean_up_passwords(build_resource)
8a15ac6 @josevalim Stub out other views for Registerable.
josevalim authored
8 render_with_scope :new
7ce49cb @carlosantoniodasilva Configuring session and password controllers as engine, and getting i…
carlosantoniodasilva authored
9 end
10
b21b629 @carlosantoniodasilva Better documentation.
carlosantoniodasilva authored
11 # POST /resource/sign_in
7ce49cb @carlosantoniodasilva Configuring session and password controllers as engine, and getting i…
carlosantoniodasilva authored
12 def create
ef34800 @josevalim Ensure we are pointing to the proper sessions controller on failure.
josevalim authored
13 resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
e8e3df3 @sikachu Add support for non-navigational format response to SessionsController
sikachu authored
14 set_flash_message(:notice, :signed_in) if is_navigational_format?
15 sign_in(resource_name, resource)
16 respond_with resource, :location => redirect_location(resource_name, resource)
7ce49cb @carlosantoniodasilva Configuring session and password controllers as engine, and getting i…
carlosantoniodasilva authored
17 end
18
b21b629 @carlosantoniodasilva Better documentation.
carlosantoniodasilva authored
19 # GET /resource/sign_out
7ce49cb @carlosantoniodasilva Configuring session and password controllers as engine, and getting i…
carlosantoniodasilva authored
20 def destroy
e4c5158 @josevalim Sign out by default will destroy the existing session.
josevalim authored
21 signed_in = signed_in?(resource_name)
0487e9e @sikachu Add support for `destory_user_session_path` in another non-navigation…
sikachu authored
22 Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
e4c5158 @josevalim Sign out by default will destroy the existing session.
josevalim authored
23 set_flash_message :notice, :signed_out if signed_in
0487e9e @sikachu Add support for `destory_user_session_path` in another non-navigation…
sikachu authored
24
25 # We actually need to hard coded this, as Rails default responder doesn't
26 # support returning empty response on GET request
27 respond_to do |format|
28 format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name) }
29 format.xml { head :ok }
30 format.json { render :text => '{}', :status => :ok }
31 end
7ce49cb @carlosantoniodasilva Configuring session and password controllers as engine, and getting i…
carlosantoniodasilva authored
32 end
33 end
Something went wrong with that request. Please try again.