mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
ui(auth): add support for using a security key
This commit is contained in:
@@ -32,7 +32,7 @@ class WebauthnController extends AbstractLoginController
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
*/
|
||||
public function auth(Request $request): JsonResponse
|
||||
public function auth(Request $request)
|
||||
{
|
||||
if ($this->hasTooManyLoginAttempts($request)) {
|
||||
$this->sendLockoutResponse($request);
|
||||
|
||||
@@ -14,17 +14,12 @@ class RequireTwoFactorAuthentication
|
||||
public const LEVEL_ADMIN = 1;
|
||||
public const LEVEL_ALL = 2;
|
||||
|
||||
/**
|
||||
* @var \Prologue\Alerts\AlertsMessageBag
|
||||
*/
|
||||
private $alert;
|
||||
|
||||
/**
|
||||
* The route to redirect a user to to enable 2FA.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectRoute = '/account';
|
||||
protected string $redirectRoute = '/account';
|
||||
|
||||
private AlertsMessageBag $alert;
|
||||
|
||||
/**
|
||||
* RequireTwoFactorAuthentication constructor.
|
||||
@@ -60,7 +55,7 @@ class RequireTwoFactorAuthentication
|
||||
// send them right through, nothing else needs to be checked.
|
||||
//
|
||||
// If the level is set as admin and the user is not an admin, pass them through as well.
|
||||
if ($level === self::LEVEL_NONE || $user->use_totp) {
|
||||
if ($level === self::LEVEL_NONE || ($user->use_totp || $user->webauthnKeys()->count() > 0)) {
|
||||
return $next($request);
|
||||
} elseif ($level === self::LEVEL_ADMIN && !$user->root_admin) {
|
||||
return $next($request);
|
||||
|
||||
Reference in New Issue
Block a user