I am trying to change the inactive logout time for certain users to a longer time. By default a user has 4 hours of inactive time before they are logged out. I would like to change that to 6 hours for certain user. Below is my user components in protected/config/main.php
'user' => array (
// set auto logout timeouts
'absoluteAuthTimeout' => 60*60*24, // Log out after 24 hours regardless of activity
'authTimeout' => 60*60*4, // logout after 4 hours of inactivity
'loginUrl' => array('site/index'),
'class' => 'WebUser'
),
I have a sandboxcontroller that I use for testing. this is what I have in /protected/controlers/SandboxController.php
public function actionUserInfo(){
echo "<pre>";
var_dump(Yii::app()->user);
echo "</pre>";
//Yii::app()->user->authTimeout = 20000;
Yii::app()->user->setState("authTimeout2", 20000);
echo "<pre>";
var_dump(Yii::app()->user);
echo "</pre>";
}
The following will output:
If I switch the commented out code:
Yii::app()->user->authTimeout = 20000;
//Yii::app()->user->setState("authTimeout2", 20000);
And I get
but If I refresh the page I get the same result, so the new value for ‘authTimeout’ is not saving. How do I save a new ‘authTimeout’ for a user?