Added Google Two Factor Authentication. Closes #326.

This commit is contained in:
James Brooks
2015-01-09 09:03:07 +00:00
committed by James Brooks
parent 20f744602a
commit de4ecf636f
20 changed files with 320 additions and 75 deletions

View File

@@ -8,6 +8,7 @@ use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use PragmaRX\Google2FA\Vendor\Laravel\Facade as Google2FA;
class DashUserController extends Controller
{
@@ -32,6 +33,12 @@ class DashUserController extends Controller
{
$items = Binput::all();
$enable2FA = (bool) array_pull($items, 'google2fa');
// Let's enable/disable auth
$authSecret = $enable2FA && ! Auth::user()->hasEnabled2FA ? Google2FA::generateSecretKey() : '';
$items['google_2fa_secret'] = $authSecret;
$updated = Auth::user()->update($items);
return Redirect::back()->with('updated', $updated);