[#10754] verify email when using login token
This commit is contained in:
parent
95eb9ef9d4
commit
d1749c2baf
2 changed files with 3 additions and 0 deletions
|
@ -92,6 +92,8 @@ class Users::SessionsController < Devise::SessionsController
|
||||||
# redirect to root_path otherwise
|
# redirect to root_path otherwise
|
||||||
|
|
||||||
if instructeur_signed_in?
|
if instructeur_signed_in?
|
||||||
|
current_user.update!(email_verified_at: Time.zone.now)
|
||||||
|
|
||||||
redirect_to after_sign_in_path_for(:user)
|
redirect_to after_sign_in_path_for(:user)
|
||||||
else
|
else
|
||||||
redirect_to new_user_session_path
|
redirect_to new_user_session_path
|
||||||
|
|
|
@ -217,6 +217,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
it { is_expected.to redirect_to root_path }
|
it { is_expected.to redirect_to root_path }
|
||||||
it { expect(controller.current_instructeur).to eq(instructeur) }
|
it { expect(controller.current_instructeur).to eq(instructeur) }
|
||||||
it { expect(controller).to have_received(:trust_device) }
|
it { expect(controller).to have_received(:trust_device) }
|
||||||
|
it { expect(controller.current_instructeur.user.email_verified_at).not_to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the token is invalid' do
|
context 'when the token is invalid' do
|
||||||
|
|
Loading…
Reference in a new issue