I have function login on its successful function control goes to dashboard/index
. Suppose a user enter leads/index
the page come back to login due to access rules defined, i just want that after successful login control goes to last URL entered i.e. leads/index
.
... Controller extends CController (){
...
public function init() {
if($this->isValidForRedirectRequest(Yii::app()->request)){
Yii::app()->user->returnUrl = Yii::app()->request->requestUri;
}
}
...
public function isValidForRedirectRequest(){
/*something validations of request, like isAjax or other */
}
}...
... LoginController()...{
if($authIdentity->authenticate()) $this->redirect(Yii::app()->user->returnUrl);
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With