FosUserBundle注册后确认电子邮件

时间:2018-06-25 14:33:50

标签: symfony fosuserbundle confirmation-email

我要在我的网站上每次注册新用户后进行电子邮件确认,因此注册完成后,系统必须将他重定向到另一个页面,该页面告诉他应确认他的电子邮件地址,并且仅授予用户访问权限他们有一个已激活的邮件地址。

我的配置文件是:

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'

这是我遇到的错误:

  

类型错误:传递给FOS \ UserBundle \ EventListener \ EmailConfirmationListener :: onRegistrationSuccess()的参数1必须是FOS \ UserBundle \ Event \ FormEvent的实例,是FOS \ UserBundle \ Event \ GetResponseUserEvent的实例

     

EmailConfirmationListener onRegistrationSuccess必须是FormEvent的实例

1 个答案:

答案 0 :(得分:0)

您想要实现的是默认情况下发生的事情。似乎您更改了事件监听器或制作了一个无效的事件监听器。另外,在您的配置文件中,“ template:”似乎不在正确的位置,因为它与“ enabled”和“ from_email”不匹配。

相关问题