public function onBeforeLogout()
    {
        UserOnline::removeUser($this->id);
        
        $this->identity->updateAttributes([
            'auth_token' => Yii::$app->security->hashData(Yii::$app->security->generateRandomString(), $this->identity->password_salt),
        ]);
        
        // kill all user logins for the given user
        UserLogin::updateAll(['is_destroyed' => true], ['user_id' => $this->id]);
    }