mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Implemented basic login process
This commit is contained in:
parent
0148315961
commit
26c8da8b69
@ -9,6 +9,7 @@ use App\Entity\User;
|
|||||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -31,14 +32,26 @@ class UserController extends AbstractController implements UserControllerInterfa
|
|||||||
*
|
*
|
||||||
* @Route("/user/register", name="user_register")
|
* @Route("/user/register", name="user_register")
|
||||||
*/
|
*/
|
||||||
public function register(): Response
|
public function register(Request $request): Response
|
||||||
{
|
{
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$form = $this->createFormBuilder($user)
|
$form = $this->createFormBuilder($user)
|
||||||
->add('username', TextType::class)
|
->add('username', TextType::class)
|
||||||
->add('password', PasswordType::class)
|
->add('password', PasswordType::class)
|
||||||
->add('save', SubmitType::class,['label' => 'register'])
|
->add('save', SubmitType::class, [
|
||||||
|
'label' => 'register'
|
||||||
|
])
|
||||||
->getForm();
|
->getForm();
|
||||||
return $this->render("user/register.html.twig",['form'=>$form->createView()]);
|
$form->handleRequest($request);
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
|
||||||
|
$task = $form->getData();
|
||||||
|
$entityManager = $this->getDoctrine()->getManager();
|
||||||
|
$entityManager->persist($task);
|
||||||
|
$entityManager->flush();
|
||||||
|
}
|
||||||
|
return $this->render("user/register.html.twig", [
|
||||||
|
'form' => $form->createView()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ namespace App\Controller;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -13,5 +14,5 @@ interface UserControllerInterface
|
|||||||
{
|
{
|
||||||
public function logout():Response;
|
public function logout():Response;
|
||||||
|
|
||||||
public function register():Response;
|
public function register(Request $request):Response;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user