Hi,
In MyWebUser class in checkAccess if login was not succesful I save in session last route to reopen this page on next login :
public function checkAccess($operation, $params=array(), $allowCaching=true)
{
$ret= $this->isSuperuser===true ? true : parent::checkAccess($operation, $params, $allowCaching);
if ( !$ret ) {
$route = Yii::app()->getUrlManager()->parseUrl(Yii::app()->getRequest()); // HAS relative url like backend/category/index
Yii::app()->user->setState('referer_page_route',$route);
}
return $ret;
}
And In afterLogin I get prior route and redirect to it :
public function afterLogin($fromCookie)
{
if( Rights::getAuthorizer()->isSuperuser($this->getId())===true ) {
$this->isSuperuser = true;
}
$referer_page_route= Yii::app()->user->getState('referer_page_route');
if ( !empty($referer_page_route) ) { // HAS relative url like backend/category/index
Yii::app()->controller->redirect(array( $referer_page_route) );
}
It redirects but url is like http://local-yii-tyb.com/tybapp/user/backend/category/index, I mean that url is relative to module /user, so the url is invalid.
In layout of app I added row like to set root of dir for relative urls :
<!DOCTYPE html>
<html lang="en">
<head><!-- HEAD START -->
<base href="<?php echo Yii::app()->createAbsoluteUrl('/'); ?>/">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
...
It works in all cases, exceting this. How to fix it ?
Thanks!