Merge pull request #10760 from demarches-simplifiees/fix_unverified_admin_email
ETQ Administrateur, je peux recevoir des mails lorsque je valide mon compte depuis le mail d'invitation
This commit is contained in:
commit
1515e67651
2 changed files with 8 additions and 2 deletions
|
@ -28,6 +28,8 @@ class Administrateurs::ActivateController < ApplicationController
|
|||
})
|
||||
|
||||
if user&.errors&.empty?
|
||||
user.update!(email_verified_at: Time.zone.now)
|
||||
|
||||
sign_in(user, scope: :user)
|
||||
|
||||
flash.notice = "Mot de passe enregistré"
|
||||
|
|
|
@ -28,8 +28,12 @@ describe Administrateurs::ActivateController, type: :controller do
|
|||
before { post :create, params: { administrateur: { reset_password_token: token, password: password } } }
|
||||
|
||||
context 'when the token is ok' do
|
||||
it { expect(administrateur.user.reload.valid_password?(password)).to be true }
|
||||
it { expect(response).to redirect_to(admin_procedures_path) }
|
||||
it do
|
||||
admin_user = administrateur.user.reload
|
||||
expect(admin_user.valid_password?(password)).to be true
|
||||
expect(admin_user.email_verified_at).to be_present
|
||||
expect(response).to redirect_to(admin_procedures_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the password is not strong' do
|
||||
|
|
Loading…
Reference in a new issue