laraviet / backpack2fa
Apply Google Authenticator to Laravel Backpack project
1.0.0
2019-01-06 03:02 UTC
Requires
- backpack/crud: ^3.5
- bacon/bacon-qr-code: ^1.0.3
- illuminate/support: ~5
- pragmarx/google2fa-laravel: ^0.2.0
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~7.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2024-10-06 17:46:16 UTC
README
Apply Google Authenticator to Laravel Backpack project
Prerequisite
Need to install Backpack to your Laravel project first following this instruction
Installation
Via Composer
$ composer require laraviet/backpack2fa
Setup
php artisan migrate
php artisan vendor:publish --provider=PragmaRX\\Google2FALaravel\\ServiceProvider
Edit config\auth.php
from
'guard' => 'web',
to
'guard' => 'backpack',
Edit config\google2fa.php
from
'view' => 'google2fa.index',
to
'view' => 'backpack2fa::index',
Edit app\User.php
add 'google2fa_secret'
to $fillable
and $hidden
add 2 more methods:
public function setGoogle2faSecretAttribute($value)
{
$this->attributes['google2fa_secret'] = encrypt($value);
}
public function getGoogle2faSecretAttribute($value)
{
return decrypt($value);
}