9

I have a problem when I Install FOsuserbundle. This is my problem in result:

this is my config.yml:

fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: AppBundle\Entity\User
    from_email:
        address: "%mailer_user%"
        sender_name: "%mailer_user%"

security:

# http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
    in_memory:
        memory: ~

firewalls:
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    main:
        anonymous: ~
        # activate different ways to authenticate

        # http://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
        #http_basic: ~

        # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
        #form_login: ~
encoders:
    FOS\UserBundle\Model\UserInterface: bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    fos_userbundle:
        id: fos_user.user_provider.username

firewalls:
    main:
        pattern: ^/
        form_login:
            provider: fos_userbundle
            csrf_token_generator: security.csrf.token_manager
            # if you are using Symfony < 2.8, use the following config instead:
            # csrf_provider: form.csrf_provider

        logout:       true
        anonymous:    true

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/, role: ROLE_ADMIN }

and this is my routing.yml:

fos_user: resource: "@FOSUserBundle/Resources/config/routing/all.xml"

David Walschots
  • 12,279
  • 5
  • 36
  • 59
Hamza Najemi
  • 243
  • 3
  • 9
  • 15
  • Seems like the parameter mailer_user is not defined. Have you added it to say parameters.yml? – Cerad May 01 '17 at 17:56

2 Answers2

34

The problem is with your parameters.yml file:

parameters:
    ...
    mailer_user: null
    mailer_password: null

Change that to something then you won't get the error.

Alvin Bunk
  • 7,621
  • 3
  • 29
  • 45
  • Was that the correct answer? If so can you click the checkmark by my answer. Thank you! – Alvin Bunk May 02 '17 at 18:26
  • 2
    This worked for me. They should include info about it in their official guide for configurating FOSUserBundle at http://symfony.com/doc/master/bundles/FOSUserBundle/index.html – Hekkaryk Jun 08 '17 at 22:34
13

The FOSUserBundle has built-in support for sending emails in two different instances.

These values cannot be null, so if you try to set the value of these properties either with "" or ~, the problem will persist. Give values other than null. It will work.

# /app/config.yml
fos_user:
    from_email:
        address: "testapp@testapp.com"
        sender_name: "Test App"
Nandakumar
  • 1,071
  • 2
  • 11
  • 30