After upgrading to a newer version of SonataAdminBundle and SonataUserBundle I get this exception when clicking the link Forgotten password? in the login page:
CRITICAL - Uncaught PHP Exception Twig_Error_Runtime: "Variable "adminPool" does not exist." at /home/luca/Sites/redken_cms/vendor/sonata-project/user-bundle/src/Resources/views/Admin/Security/Resetting/request.html.twig line 31
These are my composer package versions:
sonata-project/admin-bundle 3.29.0 The missing Symfony Admin ...
sonata-project/block-bundle 3.9.0 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 Cache library
sonata-project/core-bundle 3.8.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle 2.3.1 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.0.2 Doctrine2 behavioral exten...
sonata-project/doctrine-orm-admin-bundle 3.3.0 Symfony Sonata / Integrate...
sonata-project/easy-extends-bundle 2.3.0 Symfony SonataEasyExtendsB...
sonata-project/exporter 1.8.0 Lightweight Exporter library
sonata-project/media-bundle 3.10.0 Symfony SonataMediaBundle
sonata-project/notification-bundle 3.2.0 Symfony SonataNotification...
sonata-project/user-bundle 4.0.0 Symfony SonataUserBundle
symfony/symfony v2.8.32 The Symfony PHP framework
These are my settings in config.yml:
sonata_user:
security_acl: true
manager_type: orm # can be orm or mongodb
class:
user: Application\Sonata\UserBundle\Entity\User
group: Application\Sonata\UserBundle\Entity\Group
fos_user:
db_driver: orm # can be orm or odm
firewall_name: main
user_class: Application\Sonata\UserBundle\Entity\User
group:
group_class: Application\Sonata\UserBundle\Entity\Group
group_manager: sonata.user.orm.group_manager # If you're using doctrine orm (use sonata.user.mongodb.group_manager for mongodb)
service:
user_manager: sonata.user.orm.user_manager # If you're using doctrine orm (use sonata.user.mongodb.user_manager for mongodb)
from_email:
address: "%mailer_from_address%"
sender_name: "%mailer_from_sender_name%"
And these are my settings in security.yml:
security:
role_hierarchy:
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
SONATA:
- ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT # if you are using acl then this line must be commented
# https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# -> custom firewall for the admin area of the URL
admin:
pattern: /admin(.*)
context: user
form_login:
provider: fos_userbundle
login_path: /admin/login
use_forward: false
check_path: /admin/login_check
failure_path: null
logout:
path: /admin/logout
target: /admin/login
anonymous: true
# -> end custom configuration
encoders:
FOS\UserBundle\Model\UserInterface: sha512
acl:
connection: default
access_control:
# Admin login page needs to be accessed without credential
- { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
# Secured part of the site
# This config requires being logged for the whole site and having the admin role for the admin part.
# Change these rules to adapt them to your needs
- { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
Am I missing something in the configuration?
It seems it was a bug fixed in version 4.0.1. Running composer update
this morning fixed it:
https://github.com/sonata-project/SonataUserBundle/releases/tag/4.0.1