app: use password_complexity in Administrateurs::ActivateController
This commit is contained in:
parent
428ca8755f
commit
ed8b19d2eb
3 changed files with 12 additions and 8 deletions
|
@ -16,7 +16,6 @@
|
|||
|
||||
= f.label :password do
|
||||
Mot de passe
|
||||
|
||||
= render partial: 'shared/password/edit_password', locals: { form: f, controller: 'administrateurs/passwords' }
|
||||
= render 'password_complexity/field', { form: f, test_complexity: true }
|
||||
|
||||
= f.submit 'Continuer', class: 'button large primary expand', id: "submit-password", data: { disable_with: "Envoi..." }
|
||||
|
|
|
@ -110,10 +110,6 @@ Rails.application.routes.draw do
|
|||
get '/users/password/reset-link-sent' => 'users/passwords#reset_link_sent'
|
||||
end
|
||||
|
||||
devise_scope :administrateur do
|
||||
get '/administrateurs/password/test_strength' => 'administrateurs/passwords#test_strength'
|
||||
end
|
||||
|
||||
get 'password_complexity' => 'password_complexity#show', as: 'show_password_complexity'
|
||||
|
||||
#
|
||||
|
|
|
@ -2,6 +2,8 @@ feature 'As an administrateur', js: true do
|
|||
let(:super_admin) { create(:super_admin) }
|
||||
let(:admin_email) { 'new_admin@gouv.fr' }
|
||||
let(:new_admin) { Administrateur.by_email(admin_email) }
|
||||
let(:weak_password) { '12345678' }
|
||||
let(:strong_password) { 'a new, long, and complicated password!' }
|
||||
|
||||
before do
|
||||
perform_enqueued_jobs do
|
||||
|
@ -9,14 +11,21 @@ feature 'As an administrateur', js: true do
|
|||
end
|
||||
end
|
||||
|
||||
scenario 'I can register' do
|
||||
scenario 'I can register', js: true do
|
||||
expect(new_admin.reload.user.active?).to be(false)
|
||||
|
||||
confirmation_email = open_email(admin_email)
|
||||
token_params = confirmation_email.body.match(/token=[^"]+/)
|
||||
|
||||
visit "admin/activate?#{token_params}"
|
||||
fill_in :administrateur_password, with: 'my-s3cure-p4ssword'
|
||||
fill_in :administrateur_password, with: weak_password
|
||||
|
||||
expect(page).to have_text('Mot de passe très vulnérable')
|
||||
expect(page).to have_button('Continuer', disabled: true)
|
||||
|
||||
fill_in :administrateur_password, with: strong_password
|
||||
expect(page).to have_text('Mot de passe suffisamment fort et sécurisé')
|
||||
expect(page).to have_button('Continuer', disabled: false)
|
||||
|
||||
click_button 'Continuer'
|
||||
|
||||
|
|
Loading…
Reference in a new issue