In my UsersController/login i have:
if ($result->isValid()) {
$userrole_id = $this->request->getAttribute('identity')->userrole_id;
switch ($userrole_id)
{
case 3:
return $this->redirect(['controller' => 'Customers','action' => 'editcustomer/'.$this->request->getAttribute('identity')->customer_id]);
break;
case 4:
return $this->redirect(['prefix'=>'Admin','controller' => 'Customers','action' => 'index']);
break;
default:
return $this->redirect(['controller' => 'Pages', 'action' => 'display','home']);
break;
}
}
This works fine.
I just want to know, if there are concerns of doing it this way and if there is a better way to redirect the users after login, depending on the given userrole.
Maybe someone can give me a little input on this.