During creating my registration controller symfony asks this question:
‘Would you like to include the user id in the verification link to allow anonymous email verification?’
I choose [no]. But at the end i decided I would like to prevent user to log in until email is verified.
Can I change that in my existing registration controller or I have to create a new one (with option [yes] to that question)?
If its the latter (creating a new registration controller) so my question will be – how to do that? I mean my application is almost finished. Even if creating new one now will not cause additional problems what are the proper steps?
Should I just create a new controller? Will the old one be overriden or Symfony won’t let me create two with the same name? Can I delete the old one and then create a new one?
You know what I mean?
And yes – I tried including the user id to verification (in register function in Registration Controller):
$signatureComponents = $verifyEmailHelper->generateSignature(
'app_verify_email',
$user->getId(),
$user->getEmail(),
['id' => $user->getId()]
);
And then passing it to the template:
$this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
(new TemplatedEmail())
->from(new Address('[email protected]', 'Name of Application'))
->to($user->getEmail())
->subject('Please confirm your email')
->htmlTemplate('registration/confirmation_email.html.twig')
->context([
'link' => $signatureComponents->getSignedUrl()
])
);
Although the confirmation link did contain additional stuff, it didnt work. After clicking it I still got an error about passing null argument when the user id should be.
So… Create a brand new controller or is there a way to proper add the user id to confirmation link?