Integração Pangolin Proxy
This commit is contained in:
@@ -15,13 +15,31 @@ class ApiAuthController
|
||||
|
||||
if (empty($serial_key)) {
|
||||
View::json(['error' => 'Serial Key required'], 400);
|
||||
return;
|
||||
}
|
||||
|
||||
$serverModel = new Server();
|
||||
$server = $serverModel->first('serial_key', $serial_key);
|
||||
|
||||
if (!$server || $server['status'] !== 'active') {
|
||||
View::json(['error' => 'Invalid or inactive server'], 401);
|
||||
if (!$server) {
|
||||
View::json(['error' => 'Invalid server'], 401);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($server['status'] !== 'active') {
|
||||
View::json(['error' => 'Server is inactive'], 403);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check client status
|
||||
$conn = \App\Config\Database::getInstance()->getConnection();
|
||||
$stmt = $conn->prepare("SELECT status FROM clients WHERE id = :id");
|
||||
$stmt->execute(['id' => $server['client_id']]);
|
||||
$client = $stmt->fetch();
|
||||
|
||||
if (!$client || $client['status'] !== 'active') {
|
||||
View::json(['error' => 'Client is inactive'], 403);
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate IP
|
||||
|
||||
Reference in New Issue
Block a user