symfony / maker-bundle

Symfony Maker Bundle
https://symfony.com/
MIT License
3.37k stars 404 forks source link

Why is the registration confirmation link (verify-email-bundle) not working in Symfony 6 ? #1529

Open Kstein-yandex-ru opened 7 months ago

Kstein-yandex-ru commented 7 months ago

Error when clicking on the link: The link to verify your email is invalid. Please request a new link.

Link address: .../public/verify/email?expires=1714556381&id=6&signature=B1aR%2BQkz19d2Dchre8DFypMdwuQsI6x0ftxUuZ a6CWA%3D&token=UkASyA68lh94wZ9ztJHNZCE%2B49EKgbN75rHPqzIwG%2Fk% 3D

I have not changed standard files.

But I noticed that in the file Security/EmailVerifier.php d in VS Code this line is underlined in red: private VerifyEmailHelperInterface $verifyEmailHelper,

Error: syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE)

And in the file Security/LoginFormAuthenticator.php it is underlined with the same error: public function __construct(private UrlGeneratorInterface $urlGenerator)

PHP version 8.1

I also found on the Internet that you need to add |raw to the variable in the template, but I already have it.

Thank you in advance.

mdoutreluingne commented 7 months ago

Did you do composer require symfonycasts/verify-email-bundle ?

Kstein-yandex-ru commented 7 months ago

Did you do composer require symfonycasts/verify-email-bundle ?

Yes, I did. Otherwise, I think, I would not have this file: Security/EmailVerifier.php

jrushlow commented 7 months ago

Is the code working in PHP? I don't use vscode as my IDE, but this smells like a cache issue (for the ide).

try bin/console cache:clear - If there is an autowiring or autoconfigure issue - an exception should be thrown by Symfony when you clear the app cache.

Kstein-yandex-ru commented 7 months ago

Is the code working in PHP? I don't use vscode as my IDE, but this smells like a cache issue (for the ide).

try bin/console cache:clear - If there is an autowiring or autoconfigure issue - an exception should be thrown by Symfony when you clear the app cache.

Thank you for advice.

I recieve confirmation email, but after folowwing the link, I see the mistake: The link to verify your email is invalid. Please request a new link.

Cleared cache successfully without any warnings.

mdoutreluingne commented 7 months ago

I've just tested with a new Symfony 6.4 and php 8.2 project, and I have no problem. I cannot reproduce this bug.

My version of symfonycasts/verify-email-bundle is v1.17.0

Kstein-yandex-ru commented 7 months ago

If someone have time to look at the code: https://github.com/Kstein-yandex-ru/fund-agragator/tree/master

mdoutreluingne commented 7 months ago

I've just tested your project by simulating a dev environment, i.e. with a local SMTP server, and I've had no problems.

My email is valid and set is_verified to true for the user.

You may have a problem with your SMTP server

Kstein-yandex-ru commented 6 months ago

I've just tested your project by simulating a dev environment, i.e. with a local SMTP server, and I've had no problems.

My email is valid and set is_verified to true for the user.

You may have a problem with your SMTP server

Thank you. So i hope, after deploying it will work. I use Openserver. May be that is the reason. But I recieve emails, so SMTP seems to be set up correctly. Or can the link be broken by mail service (Yandex)?