[Fix #388] In avis email, redirect a signed out gest. to the dossier

This commit is contained in:
gregoirenovel 2017-06-12 10:06:41 +02:00
parent 8968675cfb
commit 96532cea6d
2 changed files with 9 additions and 1 deletions

View file

@ -1,6 +1,7 @@
class Backoffice::DossiersController < Backoffice::DossiersListController
respond_to :html, :xlsx, :ods, :csv
prepend_before_action :store_current_location, only: :show
before_action :ensure_gestionnaire_is_authorized, only: :show
def index
@ -192,6 +193,12 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
private
def store_current_location
if !gestionnaire_signed_in?
store_location_for(:gestionnaire, request.url)
end
end
def ensure_gestionnaire_is_authorized
unless current_gestionnaire.can_view_dossier?(params[:id])
flash.alert = t('errors.messages.dossier_not_found')

View file

@ -33,7 +33,8 @@ class Users::SessionsController < Sessions::SessionsController
if user_signed_in?
redirect_to after_sign_in_path_for(:user)
elsif gestionnaire_signed_in?
redirect_to backoffice_path
location = stored_location_for(:gestionnaire) || backoffice_path
redirect_to location
elsif administrateur_signed_in?
redirect_to admin_path
else