remove dead code in admin model
This commit is contained in:
parent
14e1f8d06c
commit
5a8fbde0e7
2 changed files with 0 additions and 38 deletions
|
@ -31,14 +31,6 @@ class Administrateur < ApplicationRecord
|
||||||
user&.email
|
user&.email
|
||||||
end
|
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)
|
def self.find_inactive_by_token(reset_password_token)
|
||||||
self.inactive.with_reset_password_token(reset_password_token)
|
self.inactive.with_reset_password_token(reset_password_token)
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,34 +75,4 @@ describe Administrateur, type: :model do
|
||||||
expect(Administrateur.find_by(id: administrateur.id)).to be_nil
|
expect(Administrateur.find_by(id: administrateur.id)).to be_nil
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue