简体   繁体   English

FosUserBundle注册后确认电子邮件

[英]FosUserBundle Confirm Email after registration

I want to do email confirmation after each registration of new user in my website, so when the registration is done the system must redirect him to anther page that tells that he should confirm his email address, and only give access only to users they had an activated mail address. 我想在每次在我的网站上注册新用户后都进行电子邮件确认,因此注册完成后,系统必须将他重定向到另一个页面,该页面告诉他应该确认他的电子邮件地址,并且仅授予其拥有激活的邮件地址。

My config file is: 我的配置文件是:

fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: AppBundle\User
    registration:
        confirmation:
            from_email: # Use this node only if you don't want the global email address for the confirmation email
                address:  test@example.com
                sender_name:    Example sender 
            enabled:    true # change to true for required email confirmation
           template:   '@FOSUser/Registration/email.txt.twig'

This is the error I am getting: 这是我得到的错误:

Type error: Argument 1 passed to FOS\\UserBundle\\EventListener\\EmailConfirmationListener::onRegistrationSuccess() must be an instance of FOS\\UserBundle\\Event\\FormEvent, instance of FOS\\UserBundle\\Event\\GetResponseUserEvent given 类型错误:传递给FOS \\ UserBundle \\ EventListener \\ EmailConfirmationListener :: onRegistrationSuccess()的参数1必须是FOS \\ UserBundle \\ Event \\ FormEvent的实例,是FOS \\ UserBundle \\ Event \\ GetResponseUserEvent的实例

EmailConfirmationListener onRegistrationSuccess must be an instance of FormEvent EmailConfirmationListener onRegistrationSuccess必须是FormEvent的实例

What you are trying to achieve is something that happens by default. 您尝试实现的是默认情况下发生的事情。 It seems like you changed an eventlistener or made a new one that does not work. 似乎您更改了事件监听器或制作了一个无效的事件监听器。 Also, in your config file 'template:' does not seem to be in the right place because it does not line up with 'enabled' and 'from_email'. 另外,在您的配置文件中,“ template:”似乎不在正确的位置,因为它与“ enabled”和“ from_email”不匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM