diff --git a/application/config/packages/twig.yaml b/application/config/packages/twig.yaml index 3b315dc..454a794 100644 --- a/application/config/packages/twig.yaml +++ b/application/config/packages/twig.yaml @@ -2,3 +2,4 @@ twig: paths: ['%kernel.project_dir%/templates'] debug: '%kernel.debug%' strict_variables: '%kernel.debug%' + form_themes: ['bootstrap_4_layout.html.twig'] diff --git a/application/src/Controller/UserController.php b/application/src/Controller/UserController.php index 18aa3bb..15661ac 100644 --- a/application/src/Controller/UserController.php +++ b/application/src/Controller/UserController.php @@ -5,6 +5,10 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; +use App\Entity\User; +use Symfony\Component\Form\Extension\Core\Type\PasswordType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\TextType; /** * @@ -29,6 +33,12 @@ class UserController extends AbstractController implements UserControllerInterfa */ public function register(): Response { - return $this->render("user/register.html.twig"); + $user = new User(); + $form = $this->createFormBuilder($user) + ->add('username', TextType::class) + ->add('password', PasswordType::class) + ->add('save', SubmitType::class,['label' => 'register']) + ->getForm(); + return $this->render("user/register.html.twig",['form'=>$form->createView()]); } } \ No newline at end of file diff --git a/application/src/Entity/Attribut/PasswordAttribut.php b/application/src/Entity/Attribut/PasswordAttribut.php index 3e56611..69b9e1a 100644 --- a/application/src/Entity/Attribut/PasswordAttribut.php +++ b/application/src/Entity/Attribut/PasswordAttribut.php @@ -12,7 +12,7 @@ trait PasswordAttribut { */ protected $password; - public function getPassword():string + public function getPassword():?string { return $this->password; } diff --git a/application/src/Entity/Attribut/UsernameAttribut.php b/application/src/Entity/Attribut/UsernameAttribut.php index 3ca3064..b3c3b23 100644 --- a/application/src/Entity/Attribut/UsernameAttribut.php +++ b/application/src/Entity/Attribut/UsernameAttribut.php @@ -13,7 +13,7 @@ trait UsernameAttribut{ */ protected $username; - public function getUsername():string + public function getUsername():?string { return $this->username; } diff --git a/application/templates/user/register.html.twig b/application/templates/user/register.html.twig index 34ab93c..3b8a51c 100644 --- a/application/templates/user/register.html.twig +++ b/application/templates/user/register.html.twig @@ -1,25 +1,10 @@ {% extends "frames/default.html.twig" %} {% block title %} -register +{% trans %}register{% endtrans %} {% endblock %} {% block content %} -