SessionController: flipflop trusted device
This commit is contained in:
parent
36621bffeb
commit
fb76197404
6 changed files with 11 additions and 4 deletions
|
@ -27,7 +27,7 @@ class Users::SessionsController < Sessions::SessionsController
|
|||
end
|
||||
|
||||
if gestionnaire_signed_in?
|
||||
if trusted_device?
|
||||
if trusted_device? || !current_gestionnaire.feature_enabled?(:enable_email_login_token)
|
||||
set_flash_message :notice, :signed_in
|
||||
redirect_to gestionnaire_procedures_path
|
||||
else
|
||||
|
|
|
@ -20,6 +20,7 @@ Flipflop.configure do
|
|||
feature :web_hook
|
||||
feature :publish_draft
|
||||
feature :support_form
|
||||
feature :enable_email_login_token
|
||||
|
||||
group :production do
|
||||
feature :remote_storage,
|
||||
|
|
|
@ -27,7 +27,7 @@ describe Users::SessionsController, type: :controller do
|
|||
let(:password) { 'un super mot de passe' }
|
||||
|
||||
let(:user) { create(:user, email: email, password: password) }
|
||||
let(:gestionnaire) { create(:gestionnaire, email: email, password: password) }
|
||||
let(:gestionnaire) { create(:gestionnaire, :with_trusted_device, email: email, password: password) }
|
||||
let(:administrateur) { create(:administrateur, email: email, password: password) }
|
||||
|
||||
it 'signs user in' do
|
||||
|
|
|
@ -4,4 +4,10 @@ FactoryBot.define do
|
|||
email { generate(:gestionnaire_email) }
|
||||
password { 'password' }
|
||||
end
|
||||
|
||||
trait :with_trusted_device do
|
||||
after(:create) do |gestionnaire|
|
||||
gestionnaire.update(features: { "enable_email_login_token" => true })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ feature 'Administrator connection' do
|
|||
let(:email) { 'admin1@admin.com' }
|
||||
let(:password) { 'mon chien aime les bananes' }
|
||||
let!(:admin) { create(:administrateur, email: email, password: password) }
|
||||
let!(:gestionnaire) { create(:gestionnaire, email: email, password: password) }
|
||||
let!(:gestionnaire) { create(:gestionnaire, :with_trusted_device, email: email, password: password) }
|
||||
|
||||
before do
|
||||
visit new_administrateur_session_path
|
||||
|
|
|
@ -4,7 +4,7 @@ feature 'The gestionnaire part' do
|
|||
include ActiveJob::TestHelper
|
||||
|
||||
let(:password) { 'secret_password' }
|
||||
let!(:gestionnaire) { create(:gestionnaire, password: password) }
|
||||
let!(:gestionnaire) { create(:gestionnaire, :with_trusted_device, password: password) }
|
||||
|
||||
let!(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
|
||||
let!(:dossier) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure) }
|
||||
|
|
Loading…
Reference in a new issue