upgraded google2fa (0.7->5.0) & composer deps

This commit is contained in:
Max Kovalenko
2019-05-24 20:20:57 +03:00
committed by Max Kovalenko
parent 415aeca86a
commit 6086a275bf
6 changed files with 276 additions and 146 deletions

View File

@@ -21,7 +21,7 @@ use Illuminate\Routing\Controller;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
use PragmaRX\Google2FA\Vendor\Laravel\Facade as Google2FA;
use PragmaRX\Google2FA\Google2FA;
class UserController extends Controller
{
@@ -40,6 +40,8 @@ class UserController extends Controller
* Updates the current user.
*
* @return \Illuminate\View\View
* @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException
* @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException
*/
public function postUser()
{
@@ -50,7 +52,8 @@ class UserController extends Controller
// Let's enable/disable auth
if ($enable2FA && !Auth::user()->hasTwoFactor) {
event(new UserEnabledTwoAuthEvent(Auth::user()));
$userData['google_2fa_secret'] = Google2FA::generateSecretKey();
$google2fa = new Google2FA();
$userData['google_2fa_secret'] = $google2fa->generateSecretKey();
} elseif (!$enable2FA) {
event(new UserDisabledTwoAuthEvent(Auth::user()));
$userData['google_2fa_secret'] = '';