I have actually done this and created the merge request in GitHub. It's actually a very small change that needs to be done in zfc-user/src/ZfcUser/Controlelr/UserController.php. Within authenticateAction() you need to replace this:
return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
For this:
$route = $this->getOptions()->getLoginRedirectRoute();
if(is_callable($route)) {
$route = $route($this->zfcUserAuthentication()->getIdentity());
}
return $this->redirect()->toRoute($route);
And in your config/autoload/module.zfcuser.global.php file you'll be able to use a callback for the login_redirect_route:
'login_redirect_route' => function(\ZfcUser\Entity\UserInterface $user) {
if($user->getUsername()=='Admin') {
return 'admin';
}
return 'user';
}
UserController#authenticateAction()
, this requires you to also overwrite the invokablezfcuser
to your controller. The catch is that you'll have to provide the view-templates from your Module, too ;) It's alittle tricky and quite frankly ZfcUser could need a rewrite :DUserController
, to add new Actions. But i try to solve my problem with your proposal for solution.'zfcuser' => 'App\Controller\LoginController',
as a invokable in themodule.config.php