Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgraded google2fa (0.7->5.0) #3619

Merged
merged 5 commits into from
Jul 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
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
{
Expand Down Expand Up @@ -89,6 +89,10 @@ public function showTwoFactorAuth()
*
* This feels very hacky, but we have to juggle authentication and codes.
*
* @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException
* @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException
* @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postTwoFactor()
Expand All @@ -102,7 +106,8 @@ public function postTwoFactor()

$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));
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Controllers/Dashboard/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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
{
Expand All @@ -39,6 +39,9 @@ public function showUser()
/**
* Updates the current user.
*
* @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException
* @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException
*
* @return \Illuminate\View\View
*/
public function postUser()
Expand All @@ -50,7 +53,8 @@ public function postUser()
// 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'] = '';
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"alt-three/validator": "^4.1",
"aws/aws-sdk-php": "^3.7",
"barryvdh/laravel-cors": "^0.11.0",
"chillerlan/php-qrcode": "^2.0",
"doctrine/dbal": "2.9.*",
"fideloper/proxy": "^4.0",
"graham-campbell/binput": "^6.0",
Expand All @@ -51,7 +52,7 @@
"laravel/tinker": "^1.0",
"mccool/laravel-auto-presenter": "^7.1",
"nexmo/client": "^1.5",
"pragmarx/google2fa": "^0.7.1",
"pragmarx/google2fa": "^5.0",
"predis/predis": "^1.1",
"twig/twig": "^2.6"
},
Expand Down
Loading