L'inscription Classeo se fait via invitation : un admin crée un compte, l'utilisateur reçoit un lien d'activation par email pour définir son mot de passe. Ce flow sécurisé évite les inscriptions non autorisées et garantit que seuls les utilisateurs légitimes accèdent au système. Points clés de l'implémentation : - Tokens d'activation à usage unique stockés en cache (Redis/filesystem) - Validation du consentement parental pour les mineurs < 15 ans (RGPD) - L'échec d'activation ne consume pas le token (retry possible) - Users dans un cache séparé sans TTL (pas d'expiration) - Hot reload en dev (FrankenPHP sans mode worker) Story: 1.3 - Inscription et activation de compte
39 lines
984 B
PHP
39 lines
984 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Administration\Infrastructure\Api\Resource;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Get;
|
|
use App\Administration\Infrastructure\Api\Provider\ActivationTokenInfoProvider;
|
|
|
|
/**
|
|
* API Resource for retrieving activation token information.
|
|
*
|
|
* Used by the frontend to display the establishment name and role
|
|
* before the user submits their password.
|
|
*/
|
|
#[ApiResource(
|
|
shortName: 'ActivationTokenInfo',
|
|
operations: [
|
|
new Get(
|
|
uriTemplate: '/activation-tokens/{tokenValue}',
|
|
provider: ActivationTokenInfoProvider::class,
|
|
name: 'get_activation_token_info',
|
|
),
|
|
],
|
|
)]
|
|
final readonly class ActivationTokenInfo
|
|
{
|
|
public function __construct(
|
|
public string $tokenValue,
|
|
public string $email,
|
|
public string $role,
|
|
public string $schoolName,
|
|
public bool $isExpired,
|
|
public string $expiresAt,
|
|
) {
|
|
}
|
|
}
|