mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Optimized register form
This commit is contained in:
@@ -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()]);
|
||||
}
|
||||
}
|
@@ -12,7 +12,7 @@ trait PasswordAttribut {
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
public function getPassword():string
|
||||
public function getPassword():?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ trait UsernameAttribut{
|
||||
*/
|
||||
protected $username;
|
||||
|
||||
public function getUsername():string
|
||||
public function getUsername():?string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
Reference in New Issue
Block a user