diff --git a/app/models/administrateur.rb b/app/models/administrateur.rb index d32135baa..b78428aef 100644 --- a/app/models/administrateur.rb +++ b/app/models/administrateur.rb @@ -31,14 +31,6 @@ class Administrateur < ApplicationRecord user&.email end - # 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 - errors.add(:password, :not_strong) - end - end - def self.find_inactive_by_token(reset_password_token) self.inactive.with_reset_password_token(reset_password_token) end diff --git a/spec/models/administrateur_spec.rb b/spec/models/administrateur_spec.rb index 6b449d900..f8c3e9a85 100644 --- a/spec/models/administrateur_spec.rb +++ b/spec/models/administrateur_spec.rb @@ -75,34 +75,4 @@ describe Administrateur, type: :model do expect(Administrateur.find_by(id: administrateur.id)).to be_nil end end - - # describe '#password_complexity' do - # let(:email) { 'mail@beta.gouv.fr' } - # let(:passwords) { ['pass', '12pass23', 'démarches ', 'démarches-simple', 'my-s3cure-p4ssword'] } - # let(:administrateur) { build(:administrateur, email: email, password: password) } - # let(:min_complexity) { PASSWORD_COMPLEXITY_FOR_ADMIN } - - # subject do - # administrateur.save - # administrateur.errors.full_messages - # end - - # 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 - - # 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 - - # context 'when password is acceptable' do - # let(:password) { passwords[min_complexity] } - - # it { expect(subject).to eq([]) } - # end - # end end