简体   繁体   中英

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

EmailConfirmationListener onRegistrationSuccess must be an instance of 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'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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