laraviet/backpack2fa

Apply Google Authenticator to Laravel Backpack project

1.0.0 2019-01-06 03:02 UTC

This package is auto-updated.

Last update: 2024-04-06 16:30:43 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);
}