In the event 'request_created' I check authorization. If the user is not logged in, then I want to cancel the current Request and assign a new Request for a page Login. How to do it?

有帮助吗?

解决方案

In 1.x the framework doesn't allow for request "hijacking". So your best options would be to use Response::redirect in the event listener. Optionally you could store the current URL (Uri::current()) in the session for a post login-redirect. Version 2.0 will have multiple ways to take over the request by returning a response in various places during the request cycle.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top