pb login
This commit is contained in:
parent
353884f58f
commit
5934dfcdf5
@ -50,7 +50,7 @@ security:
|
||||
# switch_user: true
|
||||
|
||||
role_hierarchy:
|
||||
ROLE_ADMIN: ROLE_ADMIN
|
||||
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
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\UserApp;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
@ -11,7 +12,9 @@ class IndexController extends AbstractController
|
||||
#[Route('/index', name: 'app_index')]
|
||||
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')]
|
||||
|
@ -11,7 +11,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/user/app')]
|
||||
#[Route('/user')]
|
||||
final class UserAppController extends AbstractController
|
||||
{
|
||||
#[Route(name: 'app_user_app_index', methods: ['GET'])]
|
||||
@ -22,25 +22,25 @@ 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('/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'])]
|
||||
public function show(UserApp $userApp): Response
|
||||
|
@ -31,11 +31,13 @@
|
||||
<a class="hover:text-teal-400" href="{{ path('app_index') }}">À propos de nous</a>
|
||||
<a class="hover:text-teal-400" href="{{ path('app_index') }}">Nous contacter</a>
|
||||
</nav>
|
||||
{% if app.user %}
|
||||
<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_user_app_show', { id: app.user.id }) }}">
|
||||
Profil
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
<h2 class="text-2xl font-bold text-center mb-2">Connexion</h2>
|
||||
<p class="text-center text-gray-600 mb-6">
|
||||
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>
|
||||
|
||||
<form method="post">
|
||||
|
@ -1,4 +1,4 @@
|
||||
<form method="post" action="{{ path('app_user_app_delete', {'id': user_app.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ user_app.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
<button class="bg-red-600 hover:bg-teal-600 text-white py-2 px-4 rounded-full">Supprimer</button>
|
||||
</form>
|
||||
|
@ -3,52 +3,40 @@
|
||||
{% block title %}UserApp{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>UserApp</h1>
|
||||
<div class="gap-y-5">
|
||||
<div class="flex gap-x-5">
|
||||
<p class="font-bold">Nom d'utilisateur : </p>
|
||||
<p>{{ user_app.nickname }}</p>
|
||||
</div>
|
||||
<div class="flex gap-x-5">
|
||||
<p class="font-bold">Rôles : </p>
|
||||
<p>{{ user_app.roles ? user_app.roles|json_encode : '' }}</p>
|
||||
</div>
|
||||
<div class="flex gap-x-5">
|
||||
<p class="font-bold">Prénom : </p>
|
||||
<p>{{ user_app.firstName }}</p>
|
||||
</div>
|
||||
<div class="flex gap-x-5">
|
||||
<p class="font-bold">Nom : </p>
|
||||
<p>{{ user_app.lastName }}</p>
|
||||
</div>
|
||||
<div class="flex gap-x-5">
|
||||
<p class="font-bold">Téléphone : </p>
|
||||
<p>{{ user_app.tel }}</p>
|
||||
</div>
|
||||
<div class="flex gap-x-5">
|
||||
<p class="font-bold">Addresse : </p>
|
||||
<p>{{ user_app.address }}</p>
|
||||
</div>
|
||||
<div class="flex gap-x-5">
|
||||
<p class="font-bold">Mail : </p>
|
||||
<p>{{ user_app.mail }}</p>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ user_app.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nickname</th>
|
||||
<td>{{ user_app.nickname }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Roles</th>
|
||||
<td>{{ user_app.roles ? user_app.roles|json_encode : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Password</th>
|
||||
<td>{{ user_app.password }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>FirstName</th>
|
||||
<td>{{ user_app.firstName }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>LastName</th>
|
||||
<td>{{ user_app.lastName }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Tel</th>
|
||||
<td>{{ user_app.tel }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Address</th>
|
||||
<td>{{ user_app.address }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Mail</th>
|
||||
<td>{{ user_app.mail }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_user_app_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('app_user_app_edit', {'id': user_app.id}) }}">edit</a>
|
||||
<a href="{{ path('app_user_app_edit', {'id': user_app.id}) }}">Modifier</a>
|
||||
|
||||
{{ include('user_app/_delete_form.html.twig') }}
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user