enable 2FA for manager

when trying to access manager, if superadmin did'nt enable otp, he/she is redirected to a page to enable 2FA. When superadmin is enabling 2FA, he has to to scan a qrcode with the 2FA application client. And afterwards, the superadmin has to log in with email, password and OTP code.
This commit is contained in:
Christophe Robillard 2020-11-04 16:35:15 +01:00
parent 3fdb045356
commit 2a0ebd062a
14 changed files with 141 additions and 20 deletions

View file

@ -7,13 +7,23 @@ describe Manager::AdministrateursController, type: :controller do
end
describe '#show' do
render_views
let(:subject) { get :show, params: { id: administrateur.id } }
before do
get :show, params: { id: administrateur.id }
context 'with 2FA not enabled' do
let(:administration) { create(:administration, otp_required_for_login: false) }
it { expect(subject).to redirect_to(edit_administration_otp_path) }
end
it { expect(response.body).to include(administrateur.email) }
context 'with 2FA enabled' do
render_views
let(:administration) { create(:administration, otp_required_for_login: true) }
before do
subject
end
it { expect(response.body).to include(administrateur.email) }
end
end
describe 'GET #new' do