upgraded google2fa (0.7->5.0) & composer deps
This commit is contained in:
committed by
Max Kovalenko
parent
415aeca86a
commit
6086a275bf
@@ -22,7 +22,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use PragmaRX\Google2FA\Vendor\Laravel\Facade as Google2FA;
|
||||
use PragmaRX\Google2FA\Google2FA;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
@@ -90,6 +90,9 @@ class AuthController extends Controller
|
||||
* This feels very hacky, but we have to juggle authentication and codes.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException
|
||||
* @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException
|
||||
* @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException
|
||||
*/
|
||||
public function postTwoFactor()
|
||||
{
|
||||
@@ -102,7 +105,8 @@ class AuthController extends Controller
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$valid = Google2FA::verifyKey($user->google_2fa_secret, $code);
|
||||
$google2fa = new Google2FA();
|
||||
$valid = $google2fa->verifyKey($user->google_2fa_secret, $code);
|
||||
|
||||
if ($valid) {
|
||||
event(new UserPassedTwoAuthEvent($user));
|
||||
|
||||
@@ -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'] = '';
|
||||
|
||||
Reference in New Issue
Block a user