✨ feat(artemis/2fa): Simplifie le nom de l'équipe dans l'e-mail.
✨ feat(artemis/base): Ajoute des barres latérales basées sur les rôles. ✨ feat(artemis/dashboard): Crée une page de tableau de bord de base. ✨ feat(security): Permet aux utilisateurs ROLE_CUSTOMER d'accéder à /artemis. 🐛 fix(MainframeAttributeListener): Corrige l'affichage du titre du site web.
This commit is contained in:
@@ -45,5 +45,5 @@ security:
|
||||
|
||||
|
||||
access_control:
|
||||
- { path: ^/artemis, roles: ROLE_ARTEMIS }
|
||||
- { path: ^/artemis, roles: [ROLE_ARTEMIS,ROLE_CUSTOMER] }
|
||||
- { path: ^/, roles: PUBLIC_ACCESS } # Toutes les autres pages nécessitent une authentification complète
|
||||
|
||||
@@ -3,14 +3,17 @@
|
||||
namespace App\Controller\Artemis;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class DashboardController extends AbstractController
|
||||
{
|
||||
#[Route('/artemis', name: 'artemis_dashboard', methods: ['GET', 'POST'])]
|
||||
public function artemis(): Response
|
||||
public function artemis(Request $request): Response
|
||||
{
|
||||
return $this->render('artemis/dashboard.twig');
|
||||
return $this->render('artemis/dashboard.twig',[
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,11 @@ class MainframeAttributeListener
|
||||
|
||||
// Gestion première connexion : changer mot de passe
|
||||
if ($account->isFirstLogin()) {
|
||||
$response = new Response($this->twig->render('admin/first_login.twig', ['account' => $account]));
|
||||
$websiteTitle = "Mainframe";
|
||||
if($request->getHost() == "espace-client.siteconseil.fr") {
|
||||
$websiteTitle = "SARL SITECONSEIL";
|
||||
}
|
||||
$response = new Response($this->twig->render('admin/first_login.twig', ['account' => $account,'websiteTitle'=>$websiteTitle]));
|
||||
if ($request->isMethod('POST')) {
|
||||
$password = $request->request->get('password');
|
||||
$password2 = $request->request->get('password2');
|
||||
@@ -73,13 +77,21 @@ class MainframeAttributeListener
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
}
|
||||
$response = new Response($this->twig->render('admin/first_login.twig', ['account' => $account, 'error' => 'Les mots de passe ne correspondent pas.']));
|
||||
$websiteTitle = "Mainframe";
|
||||
if($request->getHost() == "espace-client.siteconseil.fr") {
|
||||
$websiteTitle = "SARL SITECONSEIL";
|
||||
}
|
||||
$response = new Response($this->twig->render('admin/first_login.twig', ['account' => $account, 'error' => 'Les mots de passe ne correspondent pas.','websiteTitle'=>$websiteTitle]));
|
||||
}
|
||||
$event->setResponse($response);
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
$websiteTitle = "Mainframe";
|
||||
if($request->getHost() == "espace-client.siteconseil.fr") {
|
||||
$websiteTitle = "SARL SITECONSEIL";
|
||||
}
|
||||
// Gestion double authentification
|
||||
$session = $request->getSession();
|
||||
if (!$session?->has('2fa_valid')) {
|
||||
@@ -89,13 +101,13 @@ class MainframeAttributeListener
|
||||
$this->mailer->send(
|
||||
$account->getEmail(),
|
||||
$account->getUsername(),
|
||||
'[Mainframe] - Double authentication',
|
||||
'['.$websiteTitle.'] - Double authentication',
|
||||
'mails/artemis/2fa.twig',
|
||||
['code' => $code, 'account' => $account]
|
||||
);
|
||||
}
|
||||
|
||||
$response = new Response($this->twig->render('admin/2fa.twig', ['account' => $account]));
|
||||
$response = new Response($this->twig->render('admin/2fa.twig', ['account' => $account,'websiteTitle'=>$websiteTitle]));
|
||||
|
||||
if ($request->isMethod('POST')) {
|
||||
$codeInput = (int) $request->request->get('code');
|
||||
@@ -119,7 +131,11 @@ class MainframeAttributeListener
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
}
|
||||
$response = new Response($this->twig->render('admin/2fa.twig', ['account' => $account, 'error' => 'Code non valide !']));
|
||||
$websiteTitle = "Mainframe";
|
||||
if($request->getHost() == "espace-client.siteconseil.fr") {
|
||||
$websiteTitle = "SARL SITECONSEIL";
|
||||
}
|
||||
$response = new Response($this->twig->render('admin/2fa.twig', ['account' => $account, 'error' => 'Code non valide !','websiteTitle'=>$websiteTitle]));
|
||||
}
|
||||
|
||||
$event->setResponse($response);
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<body class="bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100">
|
||||
|
||||
<div class="flex h-screen bg-gray-100 dark:bg-gray-900">
|
||||
{% if is_granted('ROLE_ARTEMIS') %}
|
||||
<!-- Sidebar -->
|
||||
<aside id="sidebar" class="fixed top-0 left-0 z-40 w-64 h-screen bg-white dark:bg-gray-800 shadow-lg transform -translate-x-full md:translate-x-0 transition-transform duration-300 ease-in-out">
|
||||
<div class="flex items-center justify-center h-20 border-b dark:border-gray-700">
|
||||
@@ -163,6 +164,50 @@
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
{% endif %}
|
||||
{% if is_granted('ROLE_CUSTOMER') %}
|
||||
<!-- Sidebar -->
|
||||
<aside id="sidebar" class="fixed top-0 left-0 z-40 w-64 h-screen bg-white dark:bg-gray-800 shadow-lg transform -translate-x-full md:translate-x-0 transition-transform duration-300 ease-in-out">
|
||||
<div class="flex items-center justify-center h-20 border-b dark:border-gray-700">
|
||||
<h1 class="text-2xl font-bold ml-2">SARL SITECONSEIL</h1>
|
||||
</div>
|
||||
<nav class="mt-4 flex-1 sidebar-scroll overflow-y-auto" style="height: calc(100vh - 80px);">
|
||||
<ul>
|
||||
<!-- Dashboard Link -->
|
||||
<li class="px-4 py-2">
|
||||
<a href="{{ path('artemis_dashboard') }}" class="flex items-center p-2 text-base font-normal text-gray-900 dark:text-white {% if app.request.get('_route') == "artemis_dashboard"%}bg-gray-200 dark:bg-gray-700{% endif%} rounded-lg">
|
||||
<svg class="w-6 h-6 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"></path><path d="M12 2.252A8.014 8.014 0 0117.748 12H12V2.252z"></path></svg>
|
||||
<span class="ml-3">Tableau de bord</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="px-4 py-2">
|
||||
<a href="{{ path('artemis_dashboard') }}" class="flex items-center p-2 text-base font-normal text-gray-900 dark:text-white {% if app.request.get('_route') == "artemis_cc_payment"%}bg-gray-200 dark:bg-gray-700{% endif%} rounded-lg">
|
||||
<svg class="w-6 h-6 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"></path><path d="M12 2.252A8.014 8.014 0 0117.748 12H12V2.252z"></path></svg>
|
||||
<span class="ml-3">Factures</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="px-4 py-2">
|
||||
<a href="{{ path('artemis_dashboard') }}" class="flex items-center p-2 text-base font-normal text-gray-900 dark:text-white {% if app.request.get('_route') == "artemis_cc_advert"%}bg-gray-200 dark:bg-gray-700{% endif%} rounded-lg">
|
||||
<svg class="w-6 h-6 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"></path><path d="M12 2.252A8.014 8.014 0 0117.748 12H12V2.252z"></path></svg>
|
||||
<span class="ml-3">Avis de Paiement</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="px-4 py-2">
|
||||
<a href="{{ path('artemis_dashboard') }}" class="flex items-center p-2 text-base font-normal text-gray-900 dark:text-white {% if app.request.get('_route') == "artemis_cc_devis"%}bg-gray-200 dark:bg-gray-700{% endif%} rounded-lg">
|
||||
<svg class="w-6 h-6 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"></path><path d="M12 2.252A8.014 8.014 0 0117.748 12H12V2.252z"></path></svg>
|
||||
<span class="ml-3">Devis</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="px-4 py-2">
|
||||
<a href="{{ path('artemis_dashboard') }}" class="flex items-center p-2 text-base font-normal text-gray-900 dark:text-white {% if app.request.get('_route') == "artemis_cc_split"%}bg-gray-200 dark:bg-gray-700{% endif%} rounded-lg">
|
||||
<svg class="w-6 h-6 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"></path><path d="M12 2.252A8.014 8.014 0 0117.748 12H12V2.252z"></path></svg>
|
||||
<span class="ml-3">Facilité de paiement</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
{% endif %}
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="flex flex-col flex-1 md:ml-64 transition-all duration-300 ease-in-out">
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
<mj-text>Si vous n'avez pas demandé cette connexion, veuillez ignorer cet e-mail ou contacter le support si vous pensez qu'il s'agit d'une activité suspecte.</mj-text>
|
||||
|
||||
<mj-text padding-top="20px">Cordialement,</mj-text>
|
||||
<mj-text>L'équipe Mainframe</mj-text>
|
||||
<mj-text>L'équipe</mj-text>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user