diff --git a/cp/app/Controllers/DomainsController.php b/cp/app/Controllers/DomainsController.php index 138b710..a7d7aab 100644 --- a/cp/app/Controllers/DomainsController.php +++ b/cp/app/Controllers/DomainsController.php @@ -1433,6 +1433,54 @@ class DomainsController extends Controller } } + public function domainDeleteSecdns(Request $request, Response $response) + { + $db = $this->container->get('db'); + $data = $request->getParsedBody(); + $uri = $request->getUri()->getPath(); + + if ($data['record']) { + $record = filter_var($data['record'], FILTER_SANITIZE_NUMBER_INT); + $domain_id = filter_var($data['domain_id'], FILTER_SANITIZE_NUMBER_INT); + + $domainName = $db->selectValue('SELECT name FROM domain WHERE id = ?', + [ $domain_id ]); + $db->delete( + 'secdns', + [ + 'id' => $record, + 'domain_id' => $domain_id + ] + ); + + $this->container->get('flash')->addMessage('success', 'Record has been removed from domain successfully'); + + $jsonData = json_encode([ + 'success' => true, + 'redirect' => '/domain/update/'.$domainName + ]); + + $response = new \Nyholm\Psr7\Response( + 200, // Status code + ['Content-Type' => 'application/json'], // Headers + $jsonData // Body + ); + + return $response; + } else { + $jsonData = json_encode([ + 'success' => false, + 'error' => 'An error occurred while processing your request.' + ]); + + return new \Nyholm\Psr7\Response( + 400, + ['Content-Type' => 'application/json'], + $jsonData + ); + } + } + public function renewDomain(Request $request, Response $response, $args) { if ($request->getMethod() === 'POST') { diff --git a/cp/bootstrap/app.php b/cp/bootstrap/app.php index 39f46a4..27b00d5 100644 --- a/cp/bootstrap/app.php +++ b/cp/bootstrap/app.php @@ -213,6 +213,9 @@ $csrfMiddleware = function ($request, $handler) use ($container) { if ($path && $path === '/domain/deletehost') { return $handler->handle($request); } + if ($path && $path === '/domain/deletesecdns') { + return $handler->handle($request); + } // If not skipped, apply the CSRF Guard return $csrf->process($request, $handler); diff --git a/cp/resources/views/admin/domains/updateDomain.twig b/cp/resources/views/admin/domains/updateDomain.twig index a73fe28..46715df 100644 --- a/cp/resources/views/admin/domains/updateDomain.twig +++ b/cp/resources/views/admin/domains/updateDomain.twig @@ -126,22 +126,55 @@
{{ key }} | + +||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Keytag | +Algorithm | +Digest Type | +Digest | {% endif %} - {% endfor %} -|||||||
{{ value }} | + + + {% if keyDataExists %} +Flags | +Protocol | +Keydata Algorithm | +Public Key | {% endif %} ++ | |||||
{{ row.keytag }} | +{{ row.alg }} | +{{ row.digesttype }} | +{{ row.digest }} | + {% elseif row.interface == 'keyData' %} +{{ row.flags }} | +{{ row.protocol }} | +{{ row.keydata_alg }} | +{{ row.pubkey }} | + {% endif %} ++ |