Closed truckee closed 10 years ago
You don't need to use check_path
as this handled by firewall.
Eliminating the check_path
parameter results in
The check_path "/login_check" for login method "form_login" is not matched by the firewall pattern "^/staff"
Where, then, is check_path
handled by the firewall? Is it possible to view a complete working configuration (routing, security, bundle extension & configuration) anywhere?
Platform: Windows Pro 8.1, 64-bit
Starting with a fresh Symfony 2.4 installation, namespace Vol\AppBundle, adding FOSUserBundle with a Staff entity in namespace Vol\StaffBundle, then confirming that a user could log in w/ FOS, I did the following:
Launching dev environment results in:
Invalid configuration for path "security.firewalls.staff": The check_path "/login_check" for login method "form_login" is not matched by the firewall pattern "^/staff"
Ah wait check_path
defaults to '/login_check' which is not present.
Assuming the the login page is at staff/login. Set the check_path to staff/login_check'
I very much appreciate your attention to this. The latest sequence:
login_path: /staff/profile/login
check_path: /staff/profile/login_check
Configuration path "fos_user.db_driver" cannot be overwritten
("Unable to get template for "security.login", there is no such template configured.") in "FOSUserBundle:Security:login.html.twig"
- so added to VolStaffExtension (after copying from FOS)
'security' => array(
'login' => array(
'template' => 'VolStaffBundle:Security:login.html.twig',
)
),
You must configure the check path to be handled by the firewall using form_login in your security firewall configuration
If you are not otherwise engaged, I've posted the code at https://github.com/truckee/Volunteer-Project
check_path: /staff/profile/login_check
This should be check_path: /staff/login_check
, the login path is defined in https://github.com/truckee/Volunteer-Project/blob/master/src/Vol/StaffBundle/Resources/config/routing/security.xml#L11 and refers to the FOSUserBundle SecurityController.
Its only done to inform a bad configuration, but its still required none the less.
The fos_user configuration is handled using the RollerworksMultiUserBundle, you must not set it manually as that will overwrite the auto configuration.
Thanks for taking a look. The recommended change, while not throwing an error, does not eliminate the error when logging in:
You must configure the check path to be handled by the firewall using form_login in your security firewall configuration
[Note: the login_path remains /staff/profile/login
]
Found what is causing this, your templates are still using the FOSUserBundle routes. If you remove the fos_user routes (which are not needed anyway) you get an error saying that the route does not exist.
I will update the documentation to make this more clear.
Edit. You also configured some templates which are none existent, if you leave these empty they will use the RollerworksMultiUserBundle ones (which are basically the same as the FOSUserBundle templates).
Looking at this it also makes sense to make the layout-template configurable.
Thanks immensely. We're all sorted out now.
I've wrung out as many (mostly self-inflicted) error messages as I can and am left with
I get a login template at /staff/profile/login. The above error appears after submitting the form.
app/config/routing.yml snippet:
app/config/security.yml firewall snippet
[Curiously, omitting the check_path & login_path parameters threw an error.]
Staff Bundle Resources/config/routing/security.xml: