问题
I'm looking for a basic explanation of how could I do this with symfony2, since there is no decent documentation in the web about this. I know how could I do the process with plain php, but I don't know where to start with symfony2.
Any help would be really appreciated, guys.
Thanks!
To clarify what I'm looking for: once the user completes the registration process, send an automatic email with a link to activate his account
回答1:
FOSUserBundle has this feature by default.
You can do it on your own:
- Create a user specific secure hash and store it in the database at registration.
- Send an email to user containing a link with that hash:
myapp.com/signup/token/..(token here).../
- Create the relevant route to the controller that will check the hash, pass the token in the url to the controller as variable.
- Check if the hash is correct in the controller and do the relevant action.
来源:https://stackoverflow.com/questions/9571503/validate-user-account-via-email-link-in-symfony2