Merge branch 'Johan'
This commit is contained in:
2
.env
2
.env
@@ -37,5 +37,5 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
|||||||
###< symfony/messenger ###
|
###< symfony/messenger ###
|
||||||
|
|
||||||
###> symfony/mailer ###
|
###> symfony/mailer ###
|
||||||
MAILER_DSN=smtp://leroyjohan3@gmail.com:nfqvxtdxixrtjrmt@smtp.gmail.com:587
|
MAILER_DSN=smtp://
|
||||||
###< symfony/mailer ###
|
###< symfony/mailer ###
|
||||||
|
|||||||
BIN
public/upload/image/profile/pp-pro-673de6dc5508e.jpg
Normal file
BIN
public/upload/image/profile/pp-pro-673de6dc5508e.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
@@ -177,59 +177,64 @@ class AdminController extends AbstractController
|
|||||||
#[Route('/admin/user/import', name: 'participant_import', methods: ['POST'])]
|
#[Route('/admin/user/import', name: 'participant_import', methods: ['POST'])]
|
||||||
public function import(Request $request, EntityManagerInterface $em, MailerInterface $mailer, UrlGeneratorInterface $urlGenerator): RedirectResponse
|
public function import(Request $request, EntityManagerInterface $em, MailerInterface $mailer, UrlGeneratorInterface $urlGenerator): RedirectResponse
|
||||||
{
|
{
|
||||||
$file = $request->files->get('csv_file');
|
try{
|
||||||
if ($file) {
|
$file = $request->files->get('csv_file');
|
||||||
$csvData = array_map('str_getcsv', file($file->getPathname()));
|
if ($file) {
|
||||||
foreach ($csvData as $index => $row) {
|
$csvData = array_map('str_getcsv', file($file->getPathname()));
|
||||||
if ($index === 0) continue;
|
foreach ($csvData as $index => $row) {
|
||||||
$participant = new Participant();
|
if ($index === 0) continue;
|
||||||
$participant->setNom($row[0]);
|
$participant = new Participant();
|
||||||
$participant->setPrenom($row[1]);
|
$participant->setNom($row[0]);
|
||||||
$participant->setPseudo($row[2]);
|
$participant->setPrenom($row[1]);
|
||||||
$participant->setTelephone($row[3]);
|
$participant->setPseudo($row[2]);
|
||||||
$participant->setEmail($row[4]);
|
$participant->setTelephone($row[3]);
|
||||||
$participant->setAdministrateur(false);
|
$participant->setEmail($row[4]);
|
||||||
$participant->setActif(false);
|
$participant->setAdministrateur(false);
|
||||||
$participant->setRoles(explode('|', $row[7]));
|
$participant->setActif(false);
|
||||||
$participant->setPassword(password_hash("aChanger44!", PASSWORD_BCRYPT));
|
$participant->setRoles(explode('|', $row[7]));
|
||||||
$em->persist($participant);
|
$participant->setPassword(password_hash("aChanger44!", PASSWORD_BCRYPT));
|
||||||
|
$em->persist($participant);
|
||||||
|
|
||||||
// Générer un token unique
|
// Générer un token unique
|
||||||
$token = bin2hex(random_bytes(32));
|
$token = bin2hex(random_bytes(32));
|
||||||
|
|
||||||
// Enregistrer le token dans la base de données
|
// Enregistrer le token dans la base de données
|
||||||
$passwordResetToken = new PasswordResetToken();
|
$passwordResetToken = new PasswordResetToken();
|
||||||
$passwordResetToken->setToken($token)
|
$passwordResetToken->setToken($token)
|
||||||
->setEmail($participant->getEmail())
|
->setEmail($participant->getEmail())
|
||||||
->setCreatedAt(new \DateTime());
|
->setCreatedAt(new \DateTime());
|
||||||
|
|
||||||
$em->persist($passwordResetToken);
|
$em->persist($passwordResetToken);
|
||||||
|
|
||||||
// Générer un lien de réinitialisation
|
// Générer un lien de réinitialisation
|
||||||
$resetLink = $urlGenerator->generate(
|
$resetLink = $urlGenerator->generate(
|
||||||
'app_password_reset',
|
'app_password_reset',
|
||||||
['token' => $token],
|
['token' => $token],
|
||||||
UrlGeneratorInterface::ABSOLUTE_URL
|
UrlGeneratorInterface::ABSOLUTE_URL
|
||||||
);
|
);
|
||||||
|
|
||||||
// Envoyer un email de notification
|
// Envoyer un email de notification
|
||||||
$email = (new Email())
|
$email = (new Email())
|
||||||
->from('contact@sortir.com')
|
->from('contact@sortir.com')
|
||||||
->to($participant->getEmail())
|
->to($participant->getEmail())
|
||||||
->subject('Sortir.com | Bienvenue sur notre site !')
|
->subject('Sortir.com | Bienvenue sur notre site !')
|
||||||
->html("
|
->html("
|
||||||
<h1>Bonjour $row[2],</h1>
|
<h1>Bonjour $row[2],</h1>
|
||||||
<p>Un administrateur du site vous a créé un compte !</p>
|
<p>Un administrateur du site vous a créé un compte !</p>
|
||||||
<p>Terminer la création de cotre compte : <a href='$resetLink' target='_blank'>Sortir.com</a></p>
|
<p>Terminer la création de cotre compte : <a href='$resetLink' target='_blank'>Sortir.com</a></p>
|
||||||
<p>Toute l'équipe de Sortir vous souhaite la bienvenue !</p>
|
<p>Toute l'équipe de Sortir vous souhaite la bienvenue !</p>
|
||||||
");
|
");
|
||||||
|
|
||||||
$mailer->send($email);
|
$mailer->send($email);
|
||||||
|
|
||||||
|
}
|
||||||
|
$em->flush();
|
||||||
}
|
}
|
||||||
$em->flush();
|
return $this->redirectToRoute('app_adminUser');
|
||||||
|
}catch(\Exception $e){
|
||||||
|
$this->addFlash('error', "Votre fichier contient des erreurs : " . $e->getMessage());
|
||||||
|
return $this->redirectToRoute('app_adminUser');
|
||||||
}
|
}
|
||||||
return $this->redirectToRoute('app_adminUser');
|
|
||||||
}
|
}
|
||||||
#[Route('/admin/user/export', name: 'participant_export')]
|
#[Route('/admin/user/export', name: 'participant_export')]
|
||||||
public function export(ParticipantRepository $participantRepository): Response
|
public function export(ParticipantRepository $participantRepository): Response
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Repository\SortieRepository;
|
||||||
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;
|
||||||
@@ -10,12 +11,14 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
|
|||||||
class MainController extends AbstractController
|
class MainController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/', name: 'home')]
|
#[Route('/', name: 'home')]
|
||||||
public function index(TokenStorageInterface $tokenStorage): Response
|
public function index(TokenStorageInterface $tokenStorage, SortieRepository $sortieRepository): Response
|
||||||
{
|
{
|
||||||
$token = $tokenStorage->getToken();
|
$token = $tokenStorage->getToken();
|
||||||
$userConnect = $token?->getUser();
|
$userConnect = $token?->getUser();
|
||||||
|
$sorties = $sortieRepository->findAll();
|
||||||
return $this->render('main/index.html.twig', [
|
return $this->render('main/index.html.twig', [
|
||||||
'profile' => $userConnect,
|
'profile' => $userConnect,
|
||||||
|
'sorties' => $sorties,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class ProfileController extends AbstractController
|
|||||||
if ($form->get('newPassword')->getData() !== $form->get('confirmPassword')->getData()) {
|
if ($form->get('newPassword')->getData() !== $form->get('confirmPassword')->getData()) {
|
||||||
$this->addFlash('error', "Les mots de passe ne correspondent pas");
|
$this->addFlash('error', "Les mots de passe ne correspondent pas");
|
||||||
return $this->render('profile/edit.html.twig', [
|
return $this->render('profile/edit.html.twig', [
|
||||||
|
'profile' => $userConnect,
|
||||||
'formProfile' => $form,
|
'formProfile' => $form,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -74,6 +75,7 @@ class ProfileController extends AbstractController
|
|||||||
if ($alreadyExists && $alreadyExists !== $profile) {
|
if ($alreadyExists && $alreadyExists !== $profile) {
|
||||||
$this->addFlash('error', "Ce pseudo existe déjà");
|
$this->addFlash('error', "Ce pseudo existe déjà");
|
||||||
return $this->render('profile/edit.html.twig', [
|
return $this->render('profile/edit.html.twig', [
|
||||||
|
'profile' => $userConnect,
|
||||||
'formProfile' => $form,
|
'formProfile' => $form,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -83,6 +85,7 @@ class ProfileController extends AbstractController
|
|||||||
if ($alreadyExists && $alreadyExists !== $profile) {
|
if ($alreadyExists && $alreadyExists !== $profile) {
|
||||||
$this->addFlash('error', "Cet email existe déjà");
|
$this->addFlash('error', "Cet email existe déjà");
|
||||||
return $this->render('profile/edit.html.twig', [
|
return $this->render('profile/edit.html.twig', [
|
||||||
|
'profile' => $userConnect,
|
||||||
'formProfile' => $form,
|
'formProfile' => $form,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -95,6 +98,7 @@ class ProfileController extends AbstractController
|
|||||||
return $this->redirectToRoute('profile_view',['uuid' => $profile->getIdParticipant()]);
|
return $this->redirectToRoute('profile_view',['uuid' => $profile->getIdParticipant()]);
|
||||||
}
|
}
|
||||||
return $this->render('profile/edit.html.twig', [
|
return $this->render('profile/edit.html.twig', [
|
||||||
|
'profile' => $userConnect,
|
||||||
'formProfile' => $form,
|
'formProfile' => $form,
|
||||||
]);
|
]);
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
|
|||||||
@@ -8,15 +8,25 @@
|
|||||||
</head>
|
</head>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{%block content %}
|
{% block content %}
|
||||||
<div class="flex justify-center items-center py-52">
|
<div class="container mt-4">
|
||||||
<div class="bg-white shadow-lg rounded-lg p-8 max-w-md text-center">
|
<div class="row">
|
||||||
<img src="{{ asset('img/logo.svg') }}" alt="Logo" class="h-28 mx-auto mb-4">
|
{% for sortie in sorties %}
|
||||||
<h3 class="text-2xl font-bold text-center pb-3">Créer une nouvelle sortie</h3>
|
<div class="col-md-4 mb-4">
|
||||||
<p class="text-gray-700 text-justify mb-4">Vous pouvez créer une liste de voeux facilement depuis mon application web ! Cliquer sur le bouton juste en dessous pour continuer</p>
|
<div class="card shadow-sm">
|
||||||
<div class="flex flex-row justify-between">
|
<div class="card-body">
|
||||||
<p>test</p>
|
<h5 class="card-title">{{ sortie.nom }}</h5>
|
||||||
|
<p class="card-text">
|
||||||
|
<strong>Date de début :</strong> {{ sortie.dateHeureDebut|date('d/m/Y H:i') }}<br>
|
||||||
|
<strong>Durée :</strong> {{ sortie.duree }} minutes<br>
|
||||||
|
<strong>Inscriptions max :</strong> {{ sortie.nbInscriptionsMax }}<br>
|
||||||
|
<strong>Infos :</strong> {{ sortie.infosSortie }}
|
||||||
|
</p>
|
||||||
|
<a href="{{ path('sortie_show', { id: sortie.idSortie }) }}" class="btn btn-primary btn-sm">Voir plus</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user