update fix deadcode, security
This commit is contained in:
@@ -4,11 +4,9 @@ namespace App\Http\Services;
|
||||
|
||||
use App\Models\ModuleHosting;
|
||||
use App\Support\Eloquent\Sluggable;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use App\Support\TlsHttpClientFactory;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class Hosting
|
||||
{
|
||||
use Sluggable;
|
||||
@@ -18,26 +16,6 @@ class Hosting
|
||||
public string|null $username = null;
|
||||
public string|null $password = null;
|
||||
|
||||
/*
|
||||
* get All Domains in hosting server
|
||||
*/
|
||||
public function getAllDomains()
|
||||
{
|
||||
$apiCheck = $this->apiCheck();
|
||||
|
||||
if ($apiCheck) {
|
||||
|
||||
return TlsHttpClientFactory::plesk()
|
||||
->withHeaders([
|
||||
'X-API-Key' => $this->apiKey,
|
||||
'accept' => 'application/json'
|
||||
])
|
||||
->get("https://" . $this->url . '/api/v2/domains')->json();
|
||||
}
|
||||
return "Login_Again";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check exits apikey
|
||||
*/
|
||||
@@ -58,7 +36,6 @@ class Hosting
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* check user exits from hosting server with email client
|
||||
*/
|
||||
@@ -85,17 +62,14 @@ class Hosting
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get All Client in hosting server
|
||||
*/
|
||||
public function CheckUserClient($customer = []): array|string
|
||||
{
|
||||
|
||||
$apiCheck = $this->apiCheck();
|
||||
|
||||
if ($apiCheck) {
|
||||
|
||||
$allClient = $this->getAllClients();
|
||||
|
||||
$clientCheck = array_filter($allClient, function ($element) use ($customer) {
|
||||
@@ -105,7 +79,6 @@ class Hosting
|
||||
});
|
||||
|
||||
if (count($clientCheck)) {
|
||||
|
||||
$Service = ModuleHosting::where('customer_id', $customer->id)->first();
|
||||
|
||||
return [
|
||||
@@ -168,7 +141,6 @@ class Hosting
|
||||
$apiCheck = $this->apiCheck();
|
||||
|
||||
if ($apiCheck) {
|
||||
|
||||
$ClientDomain = $this->GetAllDomainForCustomer($customer_id);
|
||||
|
||||
if ($ClientDomain['error'] === false) {
|
||||
@@ -201,7 +173,6 @@ class Hosting
|
||||
$apiCheck = $this->apiCheck();
|
||||
|
||||
if ($apiCheck) {
|
||||
|
||||
$allDomain = TlsHttpClientFactory::plesk()
|
||||
->withHeaders([
|
||||
'X-API-Key' => $this->apiKey,
|
||||
@@ -233,7 +204,6 @@ class Hosting
|
||||
$apiCheck = $this->apiCheck();
|
||||
|
||||
if ($apiCheck) {
|
||||
|
||||
$CreateDomain = TlsHttpClientFactory::plesk()
|
||||
->withHeaders([
|
||||
'X-API-Key' => $this->apiKey,
|
||||
@@ -269,11 +239,6 @@ class Hosting
|
||||
return "Login_Again";
|
||||
}
|
||||
|
||||
public function ChangeStatusHosting($domain_id = '', $status = 'active')
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function CreateExpirationForDomain($domain = '', $date_exp = '')
|
||||
{
|
||||
$response = TlsHttpClientFactory::plesk()
|
||||
@@ -338,25 +303,4 @@ class Hosting
|
||||
'data' => $response['message']
|
||||
];
|
||||
}
|
||||
|
||||
public function ResetPassword($account_id = 0, $password = ''): array
|
||||
{
|
||||
$response = TlsHttpClientFactory::plesk()
|
||||
->withHeaders([
|
||||
'X-API-Key' => $this->apiKey,
|
||||
'accept' => 'application/json'
|
||||
])
|
||||
->put("https://$this->url/api/v2/clients/$account_id", [
|
||||
'password' => $password
|
||||
])->json();
|
||||
if (!isset($response['code'])) {
|
||||
return [
|
||||
'error' => false
|
||||
];
|
||||
}
|
||||
return [
|
||||
'error' => true,
|
||||
'data' => $response['errors']['message']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user