From 1b38d4071d185482efdd0db37a6def13619a2613 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 9 Aug 2019 10:41:10 +0200 Subject: [PATCH] temporary remove password complexity check --- app/models/administrateur.rb | 2 +- spec/models/administrateur_spec.rb | 44 +++++++++++++++--------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/models/administrateur.rb b/app/models/administrateur.rb index c1c1ffcd2..3c242a609 100644 --- a/app/models/administrateur.rb +++ b/app/models/administrateur.rb @@ -16,7 +16,7 @@ class Administrateur < ApplicationRecord scope :inactive, -> { where(active: false) } scope :with_publiees_ou_archivees, -> { joins(:procedures).where(procedures: { aasm_state: [:publiee, :archivee] }) } - validate :password_complexity, if: Proc.new { |a| Devise.password_length.include?(a.password.try(:size)) } + # validate :password_complexity, if: Proc.new { |a| Devise.password_length.include?(a.password.try(:size)) } def password_complexity if password.present? && ZxcvbnService.new(password).score < PASSWORD_COMPLEXITY_FOR_ADMIN diff --git a/spec/models/administrateur_spec.rb b/spec/models/administrateur_spec.rb index fc016e971..6b8f83788 100644 --- a/spec/models/administrateur_spec.rb +++ b/spec/models/administrateur_spec.rb @@ -71,33 +71,33 @@ describe Administrateur, type: :model do it { expect(administrateur.feature_enabled?(:test_a)).to be_truthy } end - describe '#password_complexity' do - let(:email) { 'mail@beta.gouv.fr' } - let(:passwords) { ['pass', '12pass23', 'démarches ', 'démarches-simple', 'démarches-simplifiées-pwd'] } - let(:administrateur) { build(:administrateur, email: email, password: password) } - let(:min_complexity) { PASSWORD_COMPLEXITY_FOR_ADMIN } + # describe '#password_complexity' do + # let(:email) { 'mail@beta.gouv.fr' } + # let(:passwords) { ['pass', '12pass23', 'démarches ', 'démarches-simple', 'démarches-simplifiées-pwd'] } + # let(:administrateur) { build(:administrateur, email: email, password: password) } + # let(:min_complexity) { PASSWORD_COMPLEXITY_FOR_ADMIN } - subject do - administrateur.save - administrateur.errors.full_messages - end + # subject do + # administrateur.save + # administrateur.errors.full_messages + # end - context 'when password is too short' do - let(:password) { 's' * (PASSWORD_MIN_LENGTH - 1) } + # context 'when password is too short' do + # let(:password) { 's' * (PASSWORD_MIN_LENGTH - 1) } - it { expect(subject).to eq(["Le mot de passe est trop court"]) } - end + # it { expect(subject).to eq(["Le mot de passe est trop court"]) } + # end - context 'when password is too simple' do - let(:password) { passwords[min_complexity - 1] } + # context 'when password is too simple' do + # let(:password) { passwords[min_complexity - 1] } - it { expect(subject).to eq(["Le mot de passe n'est pas assez complexe"]) } - end + # it { expect(subject).to eq(["Le mot de passe n'est pas assez complexe"]) } + # end - context 'when password is acceptable' do - let(:password) { passwords[min_complexity] } + # context 'when password is acceptable' do + # let(:password) { passwords[min_complexity] } - it { expect(subject).to eq([]) } - end - end + # it { expect(subject).to eq([]) } + # end + # end end