While this tutorial's code uses Symfony 8, everything discussed works in Symfony 7!
// composer.json
{
"require": {
"php": ">=8.4",
"ext-ctype": "*",
"ext-iconv": "*",
"babdev/pagerfanta-bundle": "^4.6", // v4.6.0
"doctrine/dbal": "^4.4", // 4.4.3
"doctrine/doctrine-bundle": "^3.2", // 3.2.2
"doctrine/doctrine-migrations-bundle": "^3.7", // 3.7.0
"doctrine/orm": "^3.6", // 3.6.6
"knplabs/knp-time-bundle": "^2.5", // 2.5.0
"pagerfanta/doctrine-orm-adapter": "^4.8", // v4.8.0
"php-cs-fixer/shim": "^3.94", // v3.95.2
"phpdocumentor/reflection-docblock": "^5.6", // 5.6.7
"phpstan/phpdoc-parser": "^2.3", // 2.3.2
"stof/doctrine-extensions-bundle": "^1.15", // v1.15.3
"symfony/asset": "8.0.*", // v8.0.8
"symfony/asset-mapper": "8.0.*", // v8.0.11
"symfony/console": "8.0.*", // v8.0.11
"symfony/dotenv": "8.0.*", // v8.0.11
"symfony/flex": "^2.10", // v2.10.0
"symfony/form": "8.0.*", // v8.0.9
"symfony/framework-bundle": "8.0.*", // v8.0.11
"symfony/http-client": "8.0.*", // v8.0.9
"symfony/monolog-bundle": "^4.0", // v4.0.2
"symfony/property-access": "8.0.*", // v8.0.8
"symfony/property-info": "8.0.*", // v8.0.8
"symfony/rate-limiter": "8.0.*", // v8.0.14
"symfony/runtime": "8.0.*", // v8.0.12
"symfony/security-bundle": "8.0.*", // v8.0.12
"symfony/security-csrf": "8.0.*", // v8.0.8
"symfony/serializer": "8.0.*", // v8.0.10
"symfony/stimulus-bundle": "^2.34", // v2.35.0
"symfony/twig-bundle": "8.0.*", // v8.0.8
"symfony/ux-turbo": "^2.34", // v2.35.0
"symfony/validator": "8.0.*", // v8.0.10
"symfony/yaml": "8.0.*", // v8.0.12
"symfonycasts/tailwind-bundle": "^0.12.0", // v0.12.0
"twig/extra-bundle": "^3.24", // v3.24.0
"twig/twig": "^3.24" // v3.26.0
},
"require-dev": {
"symfony/debug-bundle": "8.0.*", // v8.0.8
"symfony/maker-bundle": "^1.67", // v1.67.0
"symfony/stopwatch": "8.0.*", // v8.0.8
"symfony/web-profiler-bundle": "8.0.*", // v8.0.12
"zenstruck/foundry": "^2.9" // v2.10.1
}
}
4 Comments
'There is already an account with this email'... When creating the login page, we made the error message generic, the combination of username and password is not correct instead of the username is not correct. Do those arguments not apply for this either?
But, what would you do next? Thinking out loud, behind my keyboard, should we create a page where you enter your email and then receive a link at that email to finish your registration? That way, a user can also find out someone is trying out your email and you might want to take measures...
Hey @oDD-1,
I think it would be pretty easy to figure out that a generic error means "the email has already been taken".
This is exactly the approach I think is best!
--Kevin
Awesome! Now, I'm programming as a hobby, so I'm wondering how you would secure that. A static path means easier developing, but also easy to find. Would you create a one-time path to a registration form or would you do something with a unique token so only someone with that unique token can get to the registration page?
Are you including this in the Symfony 8.2 Security Upgrades course?
Hey @oDD-1,
Unfortunately, this won't be covered in the Security extra or upgrade courses. I was still thinking about this flow and needed some tooling in place (more on that in a sec).
Here's the high-level flow:
What's cool with this flow is you don't need any kind of email verification system. All users must have verified their email in order to register.
I've been working on a generic "action link" Symfony bundle (that's what I'm calling these special links). It will be a generic way to generate these links and will include recipes (+ makers) for common scenarios: the registration flow from above, reset password, etc.
Also in the works is a "starter-kit" app. This will be similar to
symfony new --webappbut with more batteries included, this registration flow being one feature.Keep an eye on our socials and newsletter over the next couple months for news on both of these!
--Kevin
"Houston: no signs of life"
Start the conversation!