vendor/nucleos/user-bundle/src/Action/RequestResetAction.php line 21

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the NucleosUserBundle package.
  4.  *
  5.  * (c) Christian Gripp <mail@core23.de>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Nucleos\UserBundle\Action;
  11. use Nucleos\UserBundle\Form\Type\RequestPasswordFormType;
  12. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  13. use Symfony\Component\Form\FormFactoryInterface;
  14. use Symfony\Component\HttpFoundation\Response;
  15. use Symfony\Component\Routing\RouterInterface;
  16. use Twig\Environment;
  17. final class RequestResetAction
  18. {
  19.     private Environment $twig;
  20.     private FormFactoryInterface $formFactory;
  21.     private RouterInterface $router;
  22.     public function __construct(Environment $twigFormFactoryInterface $formFactoryRouterInterface $router)
  23.     {
  24.         $this->twig        $twig;
  25.         $this->formFactory $formFactory;
  26.         $this->router      $router;
  27.     }
  28.     public function __invoke(): Response
  29.     {
  30.         $form $this->formFactory
  31.             ->create(RequestPasswordFormType::class, null, [
  32.                 'action' => $this->router->generate('nucleos_user_resetting_send_email'),
  33.                 'method' => 'POST',
  34.             ])
  35.             ->add('save'SubmitType::class, [
  36.                 'label' => 'resetting.request.submit',
  37.             ])
  38.         ;
  39.         return new Response($this->twig->render('@NucleosUser/Resetting/request.html.twig', [
  40.             'form' => $form->createView(),
  41.         ]));
  42.     }
  43. }