When the user specifies they want an embedded config they no longer get a zip file containing everything *and* an embedded config

master
Tim Bazuin 5 years ago
parent e581cda081
commit 21c8c34d7d

@ -16,21 +16,29 @@ class Action extends Session
$zipFile = tempnam(sys_get_temp_dir(), '0zip');
$zip = new \ZipArchive();
$zip->open($zipFile, \ZipArchive::CREATE);
$cert = $this->post('cert');
$wantEmbedded = $this->post('want-embedded');
$server = ServerQuery::create()->findOneByFingerprint($this->post('fingerprint'));
$name = $server->getFqdn();
$this->fillZipWithCaAndConfig($zip, $server);
$cert = $this->post('cert');
if ($cert !== null && $wantEmbedded !== null) {
$certModel = CertificateQuery::create()->findOneByUserAndName($this->getUser(), $cert);
$this->fillZipWithEmbeddedConfig($zip, $server, $certModel);
$name .= '-' . $certModel->getName() . '.' . $certModel->getSerial();
}
if ($cert !== null) {
if ($cert !== null && $wantEmbedded === null) {
$certModel = CertificateQuery::create()->findOneByUserAndName($this->getUser(), $cert);
$this->addClientCertificateData($zip, $certModel);
$this->fillZipWithEmbeddedConfig($zip, $server, $certModel);
$name .= '-' . $certModel->getName() . '.' . $certModel->getSerial();
}
if ($wantEmbedded === null) {
$this->fillZipWithCaAndConfig($zip, $server);
}
$zip->close();
$zipContents = file_get_contents($zipFile);
@ -68,7 +76,7 @@ class Action extends Session
$parameters = [
'server' => $server,
'crt' => $cert->getCertificate(),
'cert' => $cert->getCertificate(),
'key' => '',
];

Loading…
Cancel
Save