<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\CmsBundle\Controller\Fragment;

use Ferienpass\CoreBundle\Controller\AbstractPrivateFragmentController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * Interstitial page for the e-mail activation link. The signed link is opened
 * with GET (which link prefetchers and security scanners also do), so the page
 * never changes state itself — it auto-POSTs back to the activation route (with
 * a no-JS fallback button), and the controller enables the account on that POST.
 *
 * `actionUrl` is the signed activation URL, passed through from the page
 * controller so the form posts to the exact same (signed) URL.
 */
class RegistrationActivate extends AbstractPrivateFragmentController
{
    public function __invoke(Request $request): Response
    {
        return $this->render('@Contao/fragment/registration_activate.html.twig', [
            'actionUrl' => (string) $request->attributes->get('actionUrl'),
        ]);
    }
}
