I was just wondering, what would be the best, and the most secure way to generate a token as unique key for a user to validate his account by email address.
I plan to do this this way :
- I am no using FOSUserBundle
- The user register through a form, the user data is save to the database with a "pending" status, and I save also in the database a "key" token to validate the user (do I really need to put this in the database ?).
- The user receive an email with a link to a controller that will check the token/key pass in the link (mysite/validate-account/?key=ljdsak544545asd), I compare it with the value we have in the database, if it matches, the user is validate.
As you can see I know pretty much how to get there I just want to make sure I use the right way to generate a unique, secure, token as a validation key in Symfony2.
Thanks for your help !