Files
nextcloud/php/src/Controller/DesecController.php
T
Simon L.andClaude Opus 4.8 454905c852 feat(desec): run registration flow in a modal iframe
Move the deSEC "register a free domain" flow out of the inline containers
page form and into a modal backed by a dedicated /desec view loaded in an
iframe. The multi-step register -> verify -> domain process now re-renders
inside the modal, so the user can adjust the details and complete email
verification without reloading the whole page each step. Only once the
domain is fully registered does the view reload the parent containers page.

- add /desec route + desec.twig standalone view
- add desec-modal.js (open/close, backdrop + Escape) and desec-done.js
  (parent reload on completion)
- redirect register POST to the /desec view so steps stay in the modal
- drop the redundant <details> wrapper in desec-register.twig, add heading
- style the modal and let <button class="button"> pick up button styles
- drive the modal iframe in the Playwright specs and update the QA checklist

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Simon L. <szaimen@e.mail.de>
2026-06-22 13:24:50 +02:00

36 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace AIO\Controller;
use AIO\Desec\DesecManager;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
readonly class DesecController {
public function __construct(
private DesecManager $desecManager,
) {
}
public function Register(Request $request, Response $response, array $args): Response {
try {
$email = (string)($request->getParsedBody()['desec_email'] ?? '');
$slug = (string)($request->getParsedBody()['desec_slug'] ?? '');
$password = (string)($request->getParsedBody()['desec_password'] ?? '');
// register() returns false when a new account was created and we are now awaiting
// the user's email verification. That is a normal state transition, not an error.
// The form is submitted from the /desec modal view (an iframe), so redirect back to
// that same view (201 + Location): the iframe re-renders the next step of the flow
// (awaiting verification, or the fully-registered success page, which then reloads
// the parent containers page). Re-rendering /desec — rather than the whole
// containers page — is what keeps the multi-step flow inside the modal.
$this->desecManager->register($email, $slug, $password);
return $response->withStatus(201)->withHeader('Location', 'desec');
} catch (\Exception $ex) {
$response->getBody()->write($ex->getMessage());
return $response->withStatus(422);
}
}
}