42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Service\KazApiService;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
|
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
|
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
|
|
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
|
|
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
|
|
|
class UserController extends AbstractController
|
|
{
|
|
|
|
// TODO : UserPasswordHasherInterface
|
|
// voir : https://symfony.com/doc/current/security/passwords.html#hashing-the-password
|
|
/**
|
|
* Permet de vérifier si un utilisateur existe dans le ldap.
|
|
*
|
|
* @param string $email L'adresse e-mail de l'utilisateur.
|
|
* @param KazApiService $apiClient Le service utilisé pour récupérer les données utilisateur.
|
|
*
|
|
* @return Response La page index utilisateur rendue.
|
|
* @throws ClientExceptionInterface
|
|
* @throws DecodingExceptionInterface
|
|
* @throws RedirectionExceptionInterface
|
|
* @throws ServerExceptionInterface
|
|
* @throws TransportExceptionInterface
|
|
*/
|
|
#[Route('/user/{email}', name: 'app_user', methods: ['GET'])]
|
|
public function index(string $email, KazApiService $apiClient): Response
|
|
{
|
|
$exist = $apiClient->getUserData($email);
|
|
|
|
return $this->render('user/index.html.twig', [
|
|
'exist' => $exist,
|
|
]);
|
|
}
|
|
} |