title: Yii2-usuario: extending login process
body: <p>Working with Yii2-usuario, I want to extend the login process by setting some session variables AFTER the user has logged in successfully. </p>
  
  <p>I tried extending the User model by:</p>
  
  <p>replacing the User class in <code>./config/web.php</code>:</p>
  
  <pre><code>'modules' =&gt; [
      'user' =&gt; [
          'class' =&gt; Da\User\Module::class,
          'classMap' =&gt; [
              'User' =&gt; app\models\user\User::class,
          ],
      ],
  ],
  </code></pre>
  
  <p>and overloading the <code>User</code>class in <code>./models/users/User.php</code>:</p>
  
  <pre><code>namespace app\models\user;
  use Da\User\Model\User as BaseUser;
  
  class User extends BaseUser
  {
      public function login(IdentityInterface $identity, $duration = 0)
      {
          $ok = parent::login();
          myNewFeature();
          return $ok;
      }
  }
  </code></pre>
  
  <p>as stated in the <a href="https://yii2-usuario.readthedocs.io/en/latest/enhancing-and-overriding/overriding-classes/" rel="nofollow noreferrer">docs</a>.</p>
  
  <p>BUT: this <code>login()</code> function never gets executed when a user logs in.</p>
  
  <p>How can I make this work?</p>