2MFA class not found

Hi Again,

After Following the Readme instructions on

i get the error of class not found, but nowhere has been shown to create class ‘TwoFaQr’
now i get this error.
when trying to call the widget.


Anyone know what im doing wrong and if so, in what file to add the class?

anyone can help?

https://www.php.net/manual/en/language.namespaces.basics.php

Thing is, i was already calling an namespace

use promocat\models\TwoFaForm

As was written in the readme in the github

I can see in the code that namespace for that file is promocat\twofa\widgets. Please check it first next time.

even adding that namespace, i get the same error

Update im still having this issue.

My user components look like this.

'components' => [
        
    'authManager' => [
        'class' => 'yii\rbac\DbManager', // or use 'yii\rbac\PhpManager'
    ],
    'user' => [
        'identityClass' => 'mdm\admin\models\User',
        'loginUrl' => ['admin/user/login'],
        'class' => promocat\twofa\User::class,
        'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
    ],
    'twoFa' => ['class' => promocat\twofa\TwoFa::class]
]

Hopefully someone knows something.

use promocat\twofa\widgets\TwoFaQr;

Thanks, after doing this i got an error.

Attempt to read property “username” on null

I added this code into my Login.php

 <div class="TwoFaQr">
              <?= TwoFaQr::widget([
    'accountName' => $model->user->username,
    'secret' => $model->secret,
    'issuer' => Yii::$app->params['twoFaIssuer'],
    'size' => 300
]); ?>
</div>

If this is not supposed to be added in the Login.php please correct me.
I’ll show an screenshot of my code to see the overall.