Skip to content

Version 2.1.0 release

Compare
Choose a tag to compare
@michaeldzjap michaeldzjap released this 13 Sep 15:46
· 109 commits to master since this release

Because the TwoFactorAuthManager class now inherits from Illuminate\Support\Manager it is possible to use your own custom provider.

To do so your provider needs to implement MichaelDzjap\TwoFactorAuth\Contracts\TwoFactorProvider (and possibly MichaelDzjap\TwoFactorAuth\Contracts\SMSToken if you want to send the authentication token via SMS).

Assuming the name of your custom provider is 'dummy', it can then be registered with TwoFactorAuthManager:

resolve(\MichaelDzjap\TwoFactorAuth\TwoFactorAuthManager)->extend('dummy', function ($app) {
    return new DummyProvider;
});

You should also add an entry for you custom provider in the 'provider' array in app/config/twofactor-auth.php:

'dummy' => [
    'driver' => 'dummy',
],

And lastly, don't forget to change the name of the provider in your .env:

TWO_FACTOR_AUTH_DRIVER=dummy