I have some pages where login is required for example ‘/shop/product/create’.
Here is the code from the yi-user LoginController
if($model->validate()) {
$this->lastViset();
if (strpos(Yii::app()->user->returnUrl,'/index.php')!==false)
$this->redirect(Yii::app()->controller->module->returnUrl);
else
$this->redirect(Yii::app()->user->returnUrl);
}
My returnUrl variable in UserModule is ‘user/profile’.
When I go to the site shop/product/create I see the login form. This is ok.
But after login I redirected always to user/profile but I want that I redirected to shop/product/create.
The problem is the following code
if (strpos(Yii::app()->user->returnUrl,’/index.php’)!==false)
because normally the user->returnUrl is application/index.php.
I think it were better when we ask about the homeUrl and only when we come from the homeUrl we should redirected to the module->returnUrl
How can I solve this without hacking the yii-user core.