Merge pull request #4912 from betagouv/3366-fix-remplir-demarche-en-cliquant-lien
permet à un instructeur de remplir une demarche en cliquant sur un lien
This commit is contained in:
commit
402d749c24
5 changed files with 17 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
include TrustedDeviceConcern
|
||||
include Pundit
|
||||
include Devise::StoreLocationExtension
|
||||
|
||||
MAINTENANCE_MESSAGE = 'Le site est actuellement en maintenance. Il sera à nouveau disponible dans un court instant.'
|
||||
|
||||
|
@ -198,7 +199,9 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# return at this location
|
||||
# after the device is trusted
|
||||
store_location_for(:user, request.fullpath)
|
||||
if get_stored_location_for(:user).blank?
|
||||
store_location_for(:user, request.fullpath)
|
||||
end
|
||||
|
||||
send_login_token_or_bufferize(current_instructeur)
|
||||
redirect_to link_sent_path(email: current_instructeur.email)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
class InvitesController < ApplicationController
|
||||
include Devise::StoreLocationExtension
|
||||
|
||||
before_action :authenticate_user!, only: [:create]
|
||||
before_action :store_user_location!, only: [:show]
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module Users
|
||||
class DossiersController < UserController
|
||||
include Devise::StoreLocationExtension
|
||||
include DossierHelper
|
||||
|
||||
layout 'procedure_context', only: [:identite, :update_identite, :siret, :update_siret]
|
||||
|
|
|
@ -164,6 +164,7 @@ describe ApplicationController, type: :controller do
|
|||
allow(@controller).to receive(:instructeur_signed_in?).and_return(instructeur_signed_in)
|
||||
allow(@controller).to receive(:sensitive_path).and_return(sensitive_path)
|
||||
allow(@controller).to receive(:send_login_token_or_bufferize)
|
||||
allow(@controller).to receive(:get_stored_location_for).and_return(nil)
|
||||
allow(@controller).to receive(:store_location_for)
|
||||
allow(IPService).to receive(:ip_trusted?).and_return(ip_trusted)
|
||||
end
|
||||
|
|
|
@ -110,4 +110,16 @@ feature 'Creating a new dossier:' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the user is not signed in' do
|
||||
let(:instructeur) { create(:instructeur) }
|
||||
let(:procedure) { create(:procedure, :published) }
|
||||
scenario 'the user is an instructeur with untrusted device' do
|
||||
visit commencer_path(path: procedure.path)
|
||||
click_on "J’ai déjà un compte"
|
||||
sign_in_with(instructeur.email, instructeur.user.password, true)
|
||||
|
||||
expect(page).to have_current_path(commencer_path(path: procedure.path))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue