Hii
I have created two user in my application 1)super User and 2)Authenticated
i want to create functionality like super user can direct login into authenticated account.
is there any way to do this by url?
view :
<?php echo CHtml::link(CHtml::tag(‘i’, array(‘class’=>‘glyphicon glyphicon-zoom-in icon-white’), ‘Login As’), array(“admin/loginas”,“user”=>$data->id),array(‘class’=>‘btn btn-success’)); ?>
controller :
private $_id;
const ERROR_EMAIL_INVALID=3;
const ERROR_STATUS_NOTACTIV=4;
const ERROR_STATUS_BAN=5;
public function actionLoginas($id)
{
//$model=new RightInfo('search');
$model=User::model()->findByPk($id);
$user=User::model()->notsafe()->findByAttributes(array('username'=>$model->username));
if($user===null)
{
$this->errorCode=self::ERROR_USERNAME_INVALID;
}
else if(Yii::app()->getModule('user')->$model->password!==$user->password)
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else if($user->parent_user!=0 && $user->role_type==1)
{
$this->_id=$user->parent_user;
$this->setState('thisuser', $user->id);
$this->setState('role', $user->role_type);
$this->username=$user->username;
$this->errorCode=self::ERROR_NONE;
}
else {
$this->_id=$user->id;
$this->username=$user->username;
$this->setState('thisuser', $user->id);
$this->setState('role', $user->role_type);
$this->errorCode=self::ERROR_NONE;
}
return !$this->errorCode;
//$model->unsetAttributes(); // clear any default values
}
error 404 invalid request
Please Help…6397