Managing Sessions

Hello,

Im new to yii and im doing a simple inventory application using and mssql. Id like to limit the number of minutes a user can stay logged in to the application, when the minutes elapse, the user should be logged out and the application displays the login page. Any idea how? Any one?

Thanks in advance. :)

I have an app the is using sessions to store user info. Not using cookies (allowAutoLogon=>false) If I don’t do anything for a while I have to log in again. I believe there is a session->timeout() that has a default value of x number of seconds. Search the docs/web ‘Yii session timeout’ and see what you get.

Hello,

You can do the following:

  • Go to your config/main.php file

  • In the section user, add following code:


 'user'=>array(

			

			'allowAutoLogin'=>false,

                        'authTimeout' => (60*30),

                        'loginUrl'=>array('site/login'),

                   ), 

In this case user will be logged out after 30 minutes, however, you can set the time you prefer.