Connection: redirect user to its procedure

This commit is contained in:
simon lehericey 2018-05-14 18:12:07 +02:00 committed by Paul Chavard
parent 6a69d958da
commit d2dc69cde0
2 changed files with 17 additions and 0 deletions

View file

@ -56,6 +56,10 @@ class ApplicationController < ActionController::Base
end
end
def after_sign_out_path_for(_resource_or_scope)
stored_location_for(:user) || super
end
private
def set_active_storage_host

View file

@ -2,6 +2,9 @@ class Users::DossiersController < UsersController
include SmartListing::Helper::ControllerExtensions
helper SmartListing::Helper
SESSION_USER_RETURN_LOCATION = 'user_return_to'
before_action :store_user_location!, only: :new
before_action :authenticate_user!, except: :commencer
before_action :check_siret, only: :siret_informations
@ -66,6 +69,8 @@ class Users::DossiersController < UsersController
end
def new
erase_user_location!
procedure = Procedure.publiees.find(params[:procedure_id])
dossier = Dossier.create(procedure: procedure, user: current_user, state: 'brouillon')
@ -234,4 +239,12 @@ class Users::DossiersController < UsersController
def facade(id = params[:id])
DossierFacades.new id, current_user.email
end
def store_user_location!
store_location_for(:user, request.fullpath)
end
def erase_user_location!
session.delete(SESSION_USER_RETURN_LOCATION)
end
end