diff --git a/php/public/index.php b/php/public/index.php
index f2ee97c9..9d34eabd 100644
--- a/php/public/index.php
+++ b/php/public/index.php
@@ -112,13 +112,7 @@ $app->post('/api/configuration', \AIO\Controller\ConfigurationController::class
$app->post('/api/desec/register', \AIO\Controller\DesecController::class . ':Register');
// Views
-// Shared closure that renders the containers page.
-// $desecVars can override 'desec_show_password', 'desec_prefill_email', and 'desec_error'.
-$renderContainersPage = function (
- Response $response,
- Request $request,
- array $desecVars = [],
-) use ($container): Response {
+$app->get('/containers', function (Request $request, Response $response, array $args) use ($container) {
$view = Twig::fromRequest($request);
$view->addExtension(new \AIO\Twig\ClassExtension());
/** @var \AIO\Data\ConfigurationManager $configurationManager */
@@ -136,7 +130,7 @@ $renderContainersPage = function (
$bypass_container_update = isset($params['bypass_container_update']);
$skip_domain_validation = isset($params['skip_domain_validation']);
- return $view->render($response, 'containers.twig', array_merge([
+ return $view->render($response, 'containers.twig', [
'domain' => $configurationManager->domain,
'apache_port' => $configurationManager->apachePort,
'borg_backup_host_location' => $configurationManager->borgBackupHostLocation,
@@ -191,39 +185,8 @@ $renderContainersPage = function (
'desec_password' => $configurationManager->desecPassword,
'is_desec_domain' => $configurationManager->isDesecDomain(),
'desec_account_registered' => $configurationManager->isDesecAccountRegistered(),
- 'desec_show_password' => false,
- 'desec_prefill_email' => '',
- 'desec_error' => '',
- ], $desecVars));
-};
-
-$app->get('/containers', function (Request $request, Response $response, array $args) use ($renderContainersPage): Response {
- return $renderContainersPage($response, $request);
+ ]);
})->setName('profile');
-
-$app->post('/containers', function (Request $request, Response $response, array $args) use ($container, $renderContainersPage): Response {
- $email = (string)($request->getParsedBody()['desec_email'] ?? '');
- $slug = (string)($request->getParsedBody()['desec_slug'] ?? '');
- $password = (string)($request->getParsedBody()['desec_password'] ?? '');
-
- /** @var \AIO\Desec\DesecManager $desecManager */
- $desecManager = $container->get(\AIO\Desec\DesecManager::class);
- try {
- $desecManager->register($email, $slug, $password);
- return $response->withStatus(303)->withHeader('Location', '/containers');
- } catch (\AIO\Desec\AlreadyRegisteredException $ex) {
- return $renderContainersPage($response, $request, [
- 'desec_show_password' => true,
- 'desec_prefill_email' => $email,
- 'desec_error' => $ex->getMessage(),
- ]);
- } catch (\Exception $ex) {
- return $renderContainersPage($response, $request, [
- 'desec_prefill_email' => $email,
- 'desec_error' => $ex->getMessage(),
- ]);
- }
-});
$app->get('/login', function (Request $request, Response $response, array $args) use ($container) {
$view = Twig::fromRequest($request);
/** @var \AIO\Docker\DockerActionManager $dockerActionManager */
diff --git a/php/src/Desec/AlreadyRegisteredException.php b/php/src/Desec/AlreadyRegisteredException.php
deleted file mode 100644
index 54ce2ee2..00000000
--- a/php/src/Desec/AlreadyRegisteredException.php
+++ /dev/null
@@ -1,17 +0,0 @@
-Your deSEC account ({{ desec_email }}) was registered successfully but the domain could not be registered. Please enter a desired subdomain slug (the part before .dedyn.io) and try again, or leave it blank for a random one.
Your deSEC login credentials (for desec.io): Email: {{ desec_email }}. Reveal deSEC password
{{ desec_password }}
{{ desec_error }}
{% endif %} - {% else %}Please enter your email address. You can also enter a desired subdomain slug (the part before .dedyn.io); leave it blank for a random one.
If you already have a deSEC account for this email address, enter your deSEC password in the optional password field below to log in with it instead of creating a new account.
- {% endif %} - {% if desec_error %}{{ desec_error }}
{% endif %} -