Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/NGINXController.php
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | private function authorizeRequest($login, $password, $clientIP) | ||||
throw new \Exception("Country code mismatch"); | throw new \Exception("Country code mismatch"); | ||||
} | } | ||||
} | } | ||||
// TODO: Apply some sort of limit for Auth-Login-Attempt -- docs say it is the number of | // TODO: Apply some sort of limit for Auth-Login-Attempt -- docs say it is the number of | ||||
// attempts over the same authAttempt. | // attempts over the same authAttempt. | ||||
// Check 2fa | // Check 2fa | ||||
if ($user->getSetting('2fa_enabled', false)) { | if (\App\CompanionApp::where('user_id', $user->id)->exists()) { | ||||
$authAttempt = \App\AuthAttempt::recordAuthAttempt($user, $clientIP); | $authAttempt = \App\AuthAttempt::recordAuthAttempt($user, $clientIP); | ||||
if (!$authAttempt->waitFor2FA()) { | if (!$authAttempt->waitFor2FA()) { | ||||
throw new \Exception("2fa failed"); | throw new \Exception("2fa failed"); | ||||
} | } | ||||
} | } | ||||
return $user; | return $user; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 204 Lines • Show Last 20 Lines |