I am trying to implement a control to check if the password is expired whenever a user authenticates. I am using a ListenerAggregateInterface
to listen to the ZfcUser
event authentication.success
.
After I perform my check I am not able to redirect the user to the change password page. How can I do that?
Looking around, usually people have a MvcEvent
and so they can use the method getReponse
to modify the headers and perform a 302 redirect, or they use redirect functionality available in controllers. In my case I have an AdapterChainEvent
and I'm not in a controller.
Any hint is highly appreciated
All you would need to do is return a response instance; it doesn't need to be the response instance (although you could inject it into your listener aggregate if you register the aggregate via the service manager).
This will stop event propagation an return the response to the controller. The
ZfcUser\Controller\UserController
will then return this performing the redirect.