fin jeudi

This commit is contained in:
allavenavr 2024-11-28 17:56:10 +01:00 committed by bourgoino
parent b702ca50ed
commit 3eca8a4421
10 changed files with 24 additions and 83 deletions

View File

@ -26,6 +26,7 @@ security:
form_login: form_login:
login_path: app_login login_path: app_login
check_path: app_login check_path: app_login
default_target_path: app_index
enable_csrf: true enable_csrf: true
logout: logout:
path: app_logout path: app_logout
@ -37,6 +38,7 @@ security:
form_login: form_login:
login_path: app_login login_path: app_login
check_path: app_login check_path: app_login
default_target_path: app_index
enable_csrf: true enable_csrf: true
logout: logout:
path: app_logout path: app_logout
@ -49,10 +51,16 @@ security:
# https://symfony.com/doc/current/security/impersonating_user.html # https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true # switch_user: true
role_hierarchy:
ROLE_ADMIN: [ ROLE_ADMIN, ROLE_EMPLOYEE, ROLE_USER ]
ROLE_EMPLOYEE: ROLE_EMPLOYEE
ROLE_USER: ROLE_USER
# Easy way to control access for large sections of your site # Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used # Note: Only the *first* access control that matches will be used
access_control: access_control:
# - { path: ^/admin, roles: ROLE_ADMIN } - { path: ^/login, roles: PUBLIC_ACCESS }
- { path: ^/register, roles: PUBLIC_ACCESS }
- { path: ^/, roles: IS_AUTHENTICATED_FULLY }
# - { path: ^/profile, roles: ROLE_USER } # - { path: ^/profile, roles: ROLE_USER }
when@test: when@test:
@ -66,4 +74,4 @@ when@test:
algorithm: auto algorithm: auto
cost: 4 # Lowest possible value for bcrypt cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon memory_cost: 10 # Lowest possible value for argon

View File

@ -22,26 +22,6 @@ final class EmployeeController extends AbstractController
]); ]);
} }
#[Route('/new', name: 'app_employee_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$employee = new Employee();
$form = $this->createForm(EmployeeType::class, $employee);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($employee);
$entityManager->flush();
return $this->redirectToRoute('app_employee_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('employee/new.html.twig', [
'employee' => $employee,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_employee_show', methods: ['GET'])] #[Route('/{id}', name: 'app_employee_show', methods: ['GET'])]
public function show(Employee $employee): Response public function show(Employee $employee): Response
{ {

View File

@ -2,6 +2,7 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\UserApp;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
@ -11,7 +12,9 @@ class IndexController extends AbstractController
#[Route('/index', name: 'app_index')] #[Route('/index', name: 'app_index')]
public function index(): Response public function index(): Response
{ {
return $this->render('index/index.html.twig', []); return $this->render('index/index.html.twig', [
'id' => $this->getUser()->getId(),
]);
} }
#[Route('/test', name: 'app_test')] #[Route('/test', name: 'app_test')]

View File

@ -22,26 +22,6 @@ final class InternController extends AbstractController
]); ]);
} }
#[Route('/new', name: 'app_intern_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$intern = new Intern();
$form = $this->createForm(InternType::class, $intern);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($intern);
$entityManager->flush();
return $this->redirectToRoute('app_intern_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('intern/new.html.twig', [
'intern' => $intern,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_intern_show', methods: ['GET'])] #[Route('/{id}', name: 'app_intern_show', methods: ['GET'])]
public function show(Intern $intern): Response public function show(Intern $intern): Response
{ {

View File

@ -11,7 +11,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
#[Route('/user/app')] #[Route('/user')]
final class UserAppController extends AbstractController final class UserAppController extends AbstractController
{ {
#[Route(name: 'app_user_app_index', methods: ['GET'])] #[Route(name: 'app_user_app_index', methods: ['GET'])]
@ -22,26 +22,6 @@ final class UserAppController extends AbstractController
]); ]);
} }
#[Route('/new', name: 'app_user_app_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$userApp = new UserApp();
$form = $this->createForm(UserAppType::class, $userApp);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($userApp);
$entityManager->flush();
return $this->redirectToRoute('app_user_app_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('user_app/new.html.twig', [
'user_app' => $userApp,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_user_app_show', methods: ['GET'])] #[Route('/{id}', name: 'app_user_app_show', methods: ['GET'])]
public function show(UserApp $userApp): Response public function show(UserApp $userApp): Response
{ {

View File

@ -52,9 +52,6 @@ class UserApp implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\Column(length: 255,nullable: true)] #[ORM\Column(length: 255,nullable: true)]
private ?string $mail = null; private ?string $mail = null;
#[ORM\Column(nullable: true)]
private bool $isVerified = false;
public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;

View File

@ -44,14 +44,7 @@ class RegistrationFormType extends AbstractType
new NotBlank(), new NotBlank(),
] ]
]) ])
// ->add('agreeTerms', CheckboxType::class, [ //
// 'mapped' => false,
// 'constraints' => [
// new IsTrue([
// 'message' => 'Vous devez accepter les conditions d\'utilisation.',
// ]),
// ],
// ])
->add('plainPassword', PasswordType::class, [ ->add('plainPassword', PasswordType::class, [
// instead of being set onto the object directly, // instead of being set onto the object directly,
// this is read and encoded in the controller // this is read and encoded in the controller

View File

@ -15,7 +15,7 @@
<p> {{ ann.description }} </p> <p> {{ ann.description }} </p>
------------------------------ ------------------------------
<p> {{ ann.creationDate|format("d-m-y") }} </p> <p> {{ ann.creationDate|date("d-m-y") }} </p>
{% endfor %} {% endfor %}

View File

@ -23,13 +23,13 @@
<div class="container mx-auto flex justify-between items-center py-4 px-6"> <div class="container mx-auto flex justify-between items-center py-4 px-6">
<div class="flex items-center"> <div class="flex items-center">
<i class="fas fa-briefcase text-2xl mr-2"></i> <i class="fas fa-briefcase text-2xl mr-2"></i>
<span class="text-xl font-bold">HegreSphere</span> <span class="text-xl font-bold" >HegreSphere</span>
</div> </div>
<nav class="space-x-6"> <nav class="space-x-20">
<a class="hover:text-teal-400" href="{{ path('app_index') }}">Accueil</a> <a class="hover:text-teal-400" href="{{ path('app_index') }}">Accueil</a>
<a class="hover:text-teal-400" href="{{ path('app_index') }}">Stages</a> <a class="hover:text-teal-400" href="{{ path('app_announcement_list') }}">Stages</a>
<a class="hover:text-teal-400" href="{{ path('app_index') }}">À propos de nous</a> <a class="hover:text-teal-400" href="{{ path('app_index') }}">FAQ</a>
<a class="hover:text-teal-400" href="{{ path('app_index') }}">Nous contacter</a> <a class="hover:text-teal-400" href="{{ path('app_index') }}">Messagerie</a>
</nav> </nav>
<div> <div>
<a class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full" href="{{ path('app_index') }}"> <a class="bg-teal-500 hover:bg-teal-600 text-white py-2 px-4 rounded-full" href="{{ path('app_index') }}">

View File

@ -7,9 +7,9 @@
<div class="bg-white p-8 rounded-lg shadow-md w-full max-w-md"> <div class="bg-white p-8 rounded-lg shadow-md w-full max-w-md">
<h2 class="text-2xl font-bold text-center mb-2">Connexion</h2> <h2 class="text-2xl font-bold text-center mb-2">Connexion</h2>
<p class="text-center text-gray-600 mb-6"> <p class="text-center text-gray-600 mb-6">
Pas encore inscrit ? Inscrivez vous !! <br> Pas encore inscrit ? Inscrivez vous ! <br>
<a href="{{ path('app_register_intern') }}" class="text-teal-600 hover:underline">En tant que Stagiaire</a> <a href="{{ path('app_register_intern') }}" class="text-teal-600 hover:underline">En tant que Stagiaire</a>
<br> |
<a href="{{ path('app_register_employee') }}" class="text-teal-600 hover:underline">En tant qu'Entreprise</a> <a href="{{ path('app_register_employee') }}" class="text-teal-600 hover:underline">En tant qu'Entreprise</a>
</p> </p>