Skip to content
Open
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
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
],
"license": "MIT",
"require": {
"php": ">=7.1.0",
"bacon/bacon-qr-code": "^2.0",
"pragmarx/recovery": "^0.1.0",
"pragmarx/google2fa-laravel": "^1.3.3"
"php": "^8.0|^8.1",
"bacon/bacon-qr-code": "^2.0.8",
"pragmarx/recovery": "^0.2.1",
"pragmarx/google2fa-laravel": "^2.1.1"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 5 additions & 5 deletions src/Google2fa.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function is2FAValid()

$google2fa = new G2fa();

return $google2fa->verifyKey(auth()->user()->user2fa->google2fa_secret, $secret, config('screen2fa.window'));
return $google2fa->verifyKey(auth()->user()->user2fa->google2fa_secret, $secret, config('google2fa.window'));
}

/**
Expand Down Expand Up @@ -110,14 +110,14 @@ public function authenticate()
$recovery = new Recovery();
$secretKey = $google2fa->generateSecretKey();
$data['recovery'] = $recovery
->setCount(config('screen2fa.recovery_codes.count'))
->setBlocks(config('screen2fa.recovery_codes.blocks'))
->setChars(config('screen2fa.recovery_codes.chars_in_block'))
->setCount(config('google2fa.recovery_codes.count'))
->setBlocks(config('google2fa.recovery_codes.blocks'))
->setChars(config('google2fa.recovery_codes.chars_in_block'))
->toArray();

$recoveryHashes = $data['recovery'];
array_walk($recoveryHashes, function (&$value) {
$value = password_hash($value, config('screen2fa.recovery_codes.hashing_algorithm'));
$value = password_hash($value, config('google2fa.recovery_codes.hashing_algorithm'));
});

User2fa::where('user_id', auth()->user()->id)->delete();
Expand Down
8 changes: 4 additions & 4 deletions src/Http/Middleware/Google2fa.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Google2fa
*/
public function handle($request, Closure $next)
{
if (!config('screen2fa.enabled')) {
if (!config('google2fa.enabled')) {
return $next($request);
}
if ($request->path() === 'los/2fa/confirm' || $request->path() === 'los/2fa/authenticate'
Expand All @@ -45,9 +45,9 @@ public function handle($request, Closure $next)
$recovery = new Recovery();
$secretKey = $google2fa->generateSecretKey();
$data['recovery'] = $recovery
->setCount(config('screen2fa.recovery_codes.count'))
->setBlocks(config('screen2fa.recovery_codes.blocks'))
->setChars(config('screen2fa.recovery_codes.chars_in_block'))
->setCount(config('google2fa.recovery_codes.count'))
->setBlocks(config('google2fa.recovery_codes.blocks'))
->setChars(config('google2fa.recovery_codes.chars_in_block'))
->toArray();

User2fa::where('user_id', auth()->user()->id)->delete();
Expand Down