✨ feat(all): Ajoute la fonctionnalité de création d'administrateur et mise à jour des mails.
This commit is contained in:
1
.env
1
.env
@@ -50,3 +50,4 @@ SENTRY_DSN=
|
||||
VITE_LOAD=0
|
||||
REDIS_DSN="redis://redis:6379"
|
||||
REAL_MAIL=0
|
||||
PATH_URL=https://esyweb.local
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
content: |
|
||||
APP_ENV=prod
|
||||
VITE_LOAD=1
|
||||
PATH_URL=https://www.e-cosplay.fr
|
||||
DATABASE_URL="postgresql://{{ db_user }}:{{ db_password }}@127.0.0.1:5432/{{ db_name }}?serverVersion=16&charset=utf8"
|
||||
REDIS_DSN="redis://{{ redis_password }}@127.0.0.1:{{ redis_port }}"
|
||||
REDIS_URL="redis://{{ redis_password }}@127.0.0.1:{{ redis_port }}"
|
||||
|
||||
@@ -33,11 +33,9 @@ class AccountCommand extends Command
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$io->title("Création d'un utilisateur administrateur");
|
||||
|
||||
$email = $io->askQuestion(new Question("Email ?"));
|
||||
|
||||
$username = $io->askQuestion(new Question("Username ?"));
|
||||
|
||||
$existingUser = $this->entityManager->getRepository(Account::class)->findOneBy(['email' => $email]);
|
||||
$existingUser = $this->entityManager->getRepository(Account::class)->findOneBy(['email' => "contact@e-cosplay.fr"]);
|
||||
if (!$existingUser instanceof Account) {
|
||||
$password = TempPasswordGenerator::generate();
|
||||
$newUser = new Account();
|
||||
@@ -45,21 +43,22 @@ class AccountCommand extends Command
|
||||
$newUser->setUuid(Uuid::v4());
|
||||
$newUser->setIsActif(true);
|
||||
$newUser->setIsFirstLogin(true);
|
||||
$newUser->setEmail($email);
|
||||
$newUser->setUsername($username);
|
||||
$newUser->setEmail("contact@e-cosplay.fr");
|
||||
$newUser->setUsername("Shoko Cosplay");
|
||||
|
||||
|
||||
|
||||
$hashedPassword = $this->userPasswordHasher->hashPassword($newUser, $password);
|
||||
$newUser->setPassword($hashedPassword);
|
||||
$this->eventDispatcher->dispatch(new CreatedAdminEvent($newUser,$password));
|
||||
|
||||
$this->entityManager->persist($newUser);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->eventDispatcher->dispatch(new CreatedAdminEvent($newUser, $password));
|
||||
|
||||
$io->success("Utilisateur administrateur créé avec succès.");
|
||||
} else {
|
||||
$this->eventDispatcher->dispatch(new CreatedAdminEvent($existingUser,""));
|
||||
$io->warning("Un utilisateur avec l'email existe déjà.");
|
||||
}
|
||||
|
||||
|
||||
@@ -39,13 +39,18 @@ class SecurityController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$eventDispatcher->dispatch($requestPasswordRequest);
|
||||
return $this->render('security/forgot_password_success.twig', [
|
||||
]);
|
||||
return $this->redirectToRoute('app_forgot_password_sent');
|
||||
}
|
||||
return $this->render('security/forgot_password.twig', [
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
#[Route(path: '/mot-de-passe-oublie/sent', name: 'app_forgot_password_sent', options: ['sitemap' => false], methods: ['GET','POST'])]
|
||||
public function forgotPasswordSent(Request $request,EventDispatcherInterface $eventDispatcher): Response
|
||||
{
|
||||
return $this->render('security/forgot_password_success.twig', [
|
||||
]);
|
||||
}
|
||||
#[Route(path: '/mot-de-passe-oublie/{id}/{token}', name: 'app_forgot_password_confirm', options: ['sitemap' => false], methods: ['GET','POST'])]
|
||||
public function forgotPasswordConfirm(Request $request): Response
|
||||
{
|
||||
|
||||
@@ -77,6 +77,7 @@ class Mailer
|
||||
$mjmlGenerator = $this->environment->render($template, [
|
||||
'system' => [
|
||||
'subject' => $subject,
|
||||
'path' => $_ENV['PATH_URL'],
|
||||
],
|
||||
'datas' => $data,
|
||||
]);
|
||||
|
||||
@@ -23,12 +23,12 @@ class MailerSubscriber
|
||||
$this->mailer->send(
|
||||
$account->getEmail(),
|
||||
$account->getUsername(),
|
||||
"[MainFrame] - Création d'un compte administrateur",
|
||||
"mails/artemis/new_admin.twig",
|
||||
"[E-COSPLAY] - Création d'un compte administrateur",
|
||||
"mails/new_admin.twig",
|
||||
[
|
||||
'username' => $account->getUsername(),
|
||||
'password' => $password,
|
||||
'url' => $this->urlGenerator->generate('app_login', [], UrlGeneratorInterface::ABSOLUTE_URL),
|
||||
'url' => $this->urlGenerator->generate('app_login'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<mj-section background-color="#ffffff" padding-bottom="0px">
|
||||
<mj-column>
|
||||
{# Logo mis à jour pour SARL SITECONSEIL #}
|
||||
<mj-image src="https://mainframe.esy-web.dev/assets/logo_siteconseil.png" alt="Logo SARL SITECONSEIL" align="center" width="150px" padding-bottom="20px"></mj-image>
|
||||
<mj-image src="{{ system.path }}{{ asset('assets/images/logo.jpg') }}" alt="Logo E-COSPLAY" align="center" width="150px" padding-bottom="20px"></mj-image>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
|
||||
@@ -48,17 +48,17 @@
|
||||
<mj-section background-color="#F2F2F2" padding-top="20px" padding-bottom="20px">
|
||||
<mj-column>
|
||||
<mj-text align="center" css-class="footer-text">
|
||||
© {{ "now"|date("Y") }} SARL SITECONSEIL. Tous droits réservés.
|
||||
© {{ "now"|date("Y") }} E-COSPLAY. Tous droits réservés.
|
||||
</mj-text>
|
||||
{# Adresse et contact de l'entreprise mis à jour pour SARL SITECONSEIL #}
|
||||
<mj-text align="center" css-class="footer-text" padding-top="10px">
|
||||
SARL SITECONSEIL, 27 Rue Le Serurier, 02100 Saint-Quentin, France
|
||||
E-COSPLAY, 42 rue de saint-quentin, 02800 Beautor, France
|
||||
<br/>
|
||||
Téléphone : 03 23 62 73 60
|
||||
Association loi 1901 à but non lucratif. - RNA N°W022006988
|
||||
|
||||
</mj-text>
|
||||
<mj-social font-size="15px" icon-size="24px" mode="horizontal" padding-top="10px">
|
||||
<mj-social-element name="facebook" href="#" background-color="#3B5998"></mj-social-element>
|
||||
<mj-social-element name="linkedin" href="#" background-color="#0077B5"></mj-social-element>
|
||||
<mj-social-element name="facebook" href="https://www.facebook.com/assocationecosplay/" background-color="#3B5998"></mj-social-element>
|
||||
<mj-social-element name="instagram" href="https://www.instagram.com/asso_ecosplay/" background-color="#0077B5"></mj-social-element>
|
||||
</mj-social>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
|
||||
30
templates/mails/new_admin.twig
Normal file
30
templates/mails/new_admin.twig
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends 'mails/base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<mj-text font-size="16px" line-height="24px">
|
||||
Bonjour,
|
||||
<br/><br/>
|
||||
Nous avons le plaisir de vous informer que votre compte administrateur a été créé.
|
||||
<br/><br/>
|
||||
Voici vos identifiants de connexion temporaires :
|
||||
<br/>
|
||||
<strong>Nom d'utilisateur :</strong> `{{ datas.username }}`
|
||||
<br/>
|
||||
<strong>Mot de passe :</strong> `{{ datas.password }}`
|
||||
<br/><br/>
|
||||
Pour des raisons de sécurité, nous vous demandons de bien vouloir modifier votre mot de passe lors de votre première connexion.
|
||||
<br/><br/>
|
||||
Vous pouvez vous connecter à votre compte en cliquant sur le lien ci-dessous :
|
||||
</mj-text>
|
||||
<mj-button href="{{ system.path }}{{ datas.url }}" background-color="#4A90E2" color="#ffffff" font-size="16px" border-radius="5px">
|
||||
Se connecter
|
||||
</mj-button>
|
||||
<mj-text font-size="16px" line-height="24px">
|
||||
<br/><br/>
|
||||
Si vous avez des questions ou rencontrez des difficultés, n'hésitez pas à nous contacter.
|
||||
<br/><br/>
|
||||
Cordialement,
|
||||
<br/>
|
||||
L'équipe E-Cosplay
|
||||
</mj-text>
|
||||
{% endblock %}
|
||||
@@ -3,7 +3,7 @@
|
||||
{% block title %}{{ 'events.reset_email_sent'|trans }}{% endblock %}
|
||||
{% block meta_description %}{{ 'events.reset_email_sent'|trans }}{% endblock %}
|
||||
|
||||
{% block canonical_url %}<link rel="canonical" href="{{ url('app_check_email') }}" />{% endblock %}
|
||||
{% block canonical_url %}<link rel="canonical" href="{{ url('app_forgot_password') }}" />{% endblock %}
|
||||
{# Pas de Breadcrumb Schema pour cette page de confirmation #}
|
||||
|
||||
{% block body %}
|
||||
|
||||
Reference in New Issue
Block a user