Validate user account via email link in symfony2

偶尔善良 提交于 2019-12-12 12:28:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!