First thanks for reading my question. I'm working on a website based on CakePHP 4 with CakeDC users installed. By default this plugin is using the url website/login to allow user to login. Because I want to change the redirect based on a parameter I have 2 options to follow.
- Create an addition login url.For example website/specialLogin
- Allow the system to use the default login with an url parameter. For example website/login/customparameter. This parameter can then trigger a different redirect url.
I have tried both option but in both case I run into the issue that I get the error from cake:
'Login URL http://website:8888/loginShoppingCart did not match CakeDC/Users or Users or login or ``.',
I have tried to find information that leads me to the root cause, but it seems the in some way Cakedc is using the cakephp urlchecker, but I do not understand how I can extend or alter the system so that it will allow me to use one of the options from my bullet list.
Does anybody knows how to change this so I can use or a custom additional URL (preferred) or URL parameters.
Any piece of information could potentially help to get this resolved.
Thanks for your feedback
The plugin provides a number of events you can use to modify the behavior, for example this one https://github.com/CakeDC/users/blob/master/Docs/Documentation/Events.md
Users.Authentication.afterLogin.It's triggered after a successful login and provides a way to redirect to a specific page. After dispatching your code, if you return a data array, the plugin will redirect to the specific url.
You can inspect the request and use a specific param or query param to redirect the user to a specific page, or redirect based on the user role for example.