Skip to content
Snippets Groups Projects
Commit ff9601fd authored by mounouar21's avatar mounouar21
Browse files
parents 65197207 10425a9a
No related branches found
No related tags found
No related merge requests found
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
#[Route('/', name: 'homepage')]
public function index(): Response
{
return $this->render('home/index.html.twig', [
'links' => [
'Register' => $this->generateUrl('register'),
'Login' => $this->generateUrl('login'),
'My Wishlists' => $this->generateUrl('app_wishlist_index'),
'Admin Dashboard' => $this->generateUrl('admin_dashboard'),
],
]);
}
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ class RegistrationController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
// Hacher le mot de passe
$hashedPassword = $passwordHasher->hashPassword($user, $user->getPassword());
$hashedPassword = $passwordHasher->hashPassword($user, $form->get('plainPassword')->getData());
$user->setPassword($hashedPassword);
// Sauvegarder l'utilisateur
......
......@@ -6,6 +6,8 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
final class UserController extends AbstractController
{
......
......@@ -5,11 +5,12 @@ namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
#[ORM\Entity(repositoryClass: UserRepository::class)]
class User implements UserInterface
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
private array $roles = [];
......@@ -34,7 +35,7 @@ class User implements UserInterface
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[ORM\Column(length: 255, unique: true)]
private ?string $email = null;
#[ORM\Column(length: 63)]
......@@ -46,11 +47,11 @@ class User implements UserInterface
#[ORM\Column(length: 255)]
private ?string $password = null;
#[ORM\Column]
private ?bool $isLocked = null;
#[ORM\Column(type: 'boolean', options: ['default' => false])]
private ?bool $isLocked = false;
#[ORM\Column]
private ?bool $isAdmin = null;
#[ORM\Column(type: 'boolean', options: ['default' => false])]
private ?bool $isAdmin = false;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
......
{% extends 'base.html.twig' %}
{% block title %}Homepage{% endblock %}
{% block body %}
<div class="container mt-5">
<h1>Welcome to the Wishlist Project</h1>
<p>Here are the main links to navigate through the project:</p>
<ul>
{% for label, url in links %}
<li><a href="{{ url }}">{{ label }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment