diff --git a/app/assets/stylesheets/commons/_forms.sass b/app/assets/stylesheets/commons/_forms.sass index 4b1f04f6b170b8ff2aaeb18ba952d2c03abb4e0a..a61cc00e3f6861e75ff75e2ed7f7daa7bd2ebeba 100644 --- a/app/assets/stylesheets/commons/_forms.sass +++ b/app/assets/stylesheets/commons/_forms.sass @@ -1,7 +1,9 @@ .password position: relative .sfpwh-password-toggle - top: calc(50% - 6px) + top: 36px +.sfpwh-controls ~ .invalid-feedback + margin-top: 0 legend ~ * clear: left diff --git a/app/models/user/with_authentication.rb b/app/models/user/with_authentication.rb index dafe47ac03888754205fb42dd58353792351dde7..933ba2c8f2b7d7b67672d9da4133ceb74008266a 100644 --- a/app/models/user/with_authentication.rb +++ b/app/models/user/with_authentication.rb @@ -78,7 +78,7 @@ module User::WithAuthentication def password_complexity # Regexp extracted from https://stackoverflow.com/questions/19605150/regex-for-password-must-contain-at-least-eight-characters-at-least-one-number-a return if password.blank? || password =~ /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#{Rails.application.config.allowed_special_chars}]).{#{Devise.password_length.first},#{Devise.password_length.last}}$/ - errors.add :password, I18n.t('activerecord.errors.models.user.password.password_strength') + errors.add :password, :password_strength end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 775168013c9dc7e5ad8d91abae9bf30b59051aa5..63a99d4280fc5b80ae95774fdbd0c1a7eaf1a4bb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -26,6 +26,12 @@ en: mobile_phone: Mobile phone picture: Profile picture role: Role + errors: + models: + user: + attributes: + password: + password_strength: doesn't match the security policy models: language: one: Language diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 571aaf22d96cf8cde34da2342dc758acdaacfe9e..72edb70922867a50cfb5596e575e0c7f822adf9b 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -26,6 +26,12 @@ fr: mobile_phone: Téléphone portable picture: Photo de profil role: Rôle + errors: + models: + user: + attributes: + password: + password_strength: ne répond pas aux critères de sécurité models: language: one: Langue