feat: email bienvenue client + bouton renvoi sur fiche + lien activation
Email bienvenue (templates/emails/client_created.html.twig) :
- Envoyé automatiquement à la création du client
- Contenu : plateforme client.siteconseil.fr, identifiant email,
bouton "Choisir mon mot de passe" avec lien app_set_password
- Compatible tous clients mail (table-based, CSS longhand)
ClientsController :
- sendWelcomeEmail() : génère le lien set_password et envoie via MailerService
- Appelé dans create() après ensureDefaultContact
- Route POST /{id}/resend-welcome : renvoie l'email si tempPassword disponible
Fiche client (show.html.twig, onglet Info) :
- Si tempPassword existe : bandeau indigo "Espace client non activé"
+ lien direct vers la page activation + bouton "Renvoyer email bienvenue"
- Si tempPassword null : bandeau vert "Espace client activé"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Controller\Admin\ClientsController;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\User;
|
||||
use App\Repository\CustomerRepository;
|
||||
use App\Service\MailerService;
|
||||
use App\Service\MeilisearchService;
|
||||
use App\Service\UserManagementService;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
@@ -77,7 +78,7 @@ class ClientsControllerTest extends TestCase
|
||||
$userService = $this->createStub(UserManagementService::class);
|
||||
$logger = $this->createStub(LoggerInterface::class);
|
||||
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), 'sk_test_***');
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), $this->createStub(MailerService::class), $this->createStub(Environment::class), 'sk_test_***');
|
||||
|
||||
$this->assertInstanceOf(Response::class, $response);
|
||||
}
|
||||
@@ -97,7 +98,7 @@ class ClientsControllerTest extends TestCase
|
||||
$userService->method('createBaseUser')->willThrowException(new \InvalidArgumentException('Champs requis'));
|
||||
$logger = $this->createStub(LoggerInterface::class);
|
||||
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), 'sk_test_***');
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), $this->createStub(MailerService::class), $this->createStub(Environment::class), 'sk_test_***');
|
||||
|
||||
$this->assertInstanceOf(Response::class, $response);
|
||||
}
|
||||
@@ -117,7 +118,7 @@ class ClientsControllerTest extends TestCase
|
||||
$userService->method('createBaseUser')->willThrowException(new \RuntimeException('DB error'));
|
||||
$logger = $this->createStub(LoggerInterface::class);
|
||||
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), 'sk_test_***');
|
||||
$response = $controller->create($request, $repo, $em, $meilisearch, $userService, $logger, $this->createStub(HttpClientInterface::class), $this->createStub(MailerService::class), $this->createStub(Environment::class), 'sk_test_***');
|
||||
|
||||
$this->assertInstanceOf(Response::class, $response);
|
||||
}
|
||||
@@ -290,6 +291,8 @@ class ClientsControllerTest extends TestCase
|
||||
$userService,
|
||||
$this->createStub(LoggerInterface::class),
|
||||
$this->createStub(HttpClientInterface::class),
|
||||
$this->createStub(MailerService::class),
|
||||
$this->createStub(Environment::class),
|
||||
'',
|
||||
);
|
||||
$this->assertSame(302, $response->getStatusCode());
|
||||
@@ -328,6 +331,8 @@ class ClientsControllerTest extends TestCase
|
||||
$userService,
|
||||
$this->createStub(LoggerInterface::class),
|
||||
$this->createStub(HttpClientInterface::class),
|
||||
$this->createStub(MailerService::class),
|
||||
$this->createStub(Environment::class),
|
||||
'sk_test_***',
|
||||
);
|
||||
$this->assertSame(302, $response->getStatusCode());
|
||||
@@ -369,6 +374,8 @@ class ClientsControllerTest extends TestCase
|
||||
$userService,
|
||||
$this->createStub(LoggerInterface::class),
|
||||
$this->createStub(HttpClientInterface::class),
|
||||
$this->createStub(MailerService::class),
|
||||
$this->createStub(Environment::class),
|
||||
'',
|
||||
);
|
||||
$this->assertSame(302, $response->getStatusCode());
|
||||
|
||||
Reference in New Issue
Block a user