demarches-normaliennes/app/controllers/users/sessions_controller.rb

41 lines
1,021 B
Ruby
Raw Normal View History

2015-09-23 10:02:01 +02:00
class Users::SessionsController < Devise::SessionsController
# before_filter :configure_sign_in_params, only: [:create]
# GET /resource/sign_in
# def new
# super
# end
#POST /resource/sign_in
def create
super
2015-10-08 11:26:12 +02:00
current_user.update_attributes(loged_in_with_france_connect: false)
end
2015-09-23 10:02:01 +02:00
# DELETE /resource/sign_out
2015-10-07 16:38:29 +02:00
def destroy
2015-10-08 11:26:12 +02:00
connected_with_france_connect = current_user.loged_in_with_france_connect
current_user.update_attributes(loged_in_with_france_connect: false)
2015-10-07 16:38:29 +02:00
signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))
set_flash_message :notice, :signed_out if signed_out && is_flashing_format?
yield if block_given?
if connected_with_france_connect
redirect_to FRANCE_CONNECT.logout_endpoint
else
respond_to_on_destroy
end
end
2015-09-23 10:02:01 +02:00
# protected
# You can put the params you want to permit in the empty array.
# def configure_sign_in_params
# devise_parameter_sanitizer.for(:sign_in) << :attribute
# end
end