title: Make sessions work in Yii
body: <p>Sad Yii is poorly documented.</p>
  
  <p>I have built an application with two modules (user and admin modules) each with its login function.</p>
  
  <p>Each user is users are referred to using <code>Yii::app()-&gt;getModule('module_name')-&gt;user</code></p>
  
  <p><strong>Problems</strong></p>
  
  <ol>
  <li>Either sessions not enabled or sessions never expire. Point is users are always logged in.</li>
  <li>When both users are logged in within the same browser, one logging out logs out the other even with using <code>getModule('module_name')</code> for reference. Problem is users are always logged in.</li>
  </ol>
  
  <p><strong>What I have tried</strong></p>
  
  <p>I have</p>
  
  <pre><code>if($identity-&gt;authenticate()){
    Yii::app()-&gt;getModule('user')-&gt;user-&gt;login($identity,5); 
    //hoped the user will be logged out after 5 seconds but didn't work
  }
  </code></pre>
  
  <p>also included the following in config/main.php</p>
  
  <pre><code>'session'=&gt;array(
              // enable cookie-based authentication
              // 'allowAutoLogin'=&gt;true,
              'timeout'=&gt;10,
          ),
  </code></pre>
  
  <p>Any help with solving the above will be appreciated. Need these users' sessions to start expiring</p>