Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
Kstein-yandex-ru opened this issue May 3, 2024 · 8 comments
Labels

Comments

@Kstein-yandex-ru
Copy link

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/#FormAuthenticator.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
Copy link
Contributor

mdoutreluingne commented May 3, 2024

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

@Kstein-yandex-ru
Copy link
Author

Kstein-yandex-ru commented May 3, 2024

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
Copy link
Collaborator

jrushlow commented May 3, 2024

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
Copy link
Author

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
Copy link
Contributor

mdoutreluingne commented May 3, 2024

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
Copy link
Author

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

@mdoutreluingne
Copy link
Contributor

mdoutreluingne commented May 4, 2024

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
Copy link
Author

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)?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants