feat: local user registration

This commit is contained in:
Björn Fromme committed 2026-06-23 16:27:08 +02:00
1 parent 8bb7f08074
commit 161029ec7c
29 files changed
+1549 -601

No files matched your search

@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace App\Tests\Support;
use App\Service\PublicFormRateLimiter;
use Symfony\Component\HttpFoundation\Request;
class TestPublicFormRateLimiter extends PublicFormRateLimiter
{
/**
* @var array<string, int>
*/
private array $counters = [];
public function __construct()
{
}
public function isRegistrationAllowed(string $email, Request $request): bool
{
return $this->consume($email, $request);
}
public function isPasswordResetAllowed(string $email, Request $request): bool
{
return $this->consume($email, $request);
}
public function createBucketKey(string $email, ?string $clientIp): string
{
return hash('sha256', mb_strtolower(trim($email)).'|'.($clientIp ?? 'unknown'));
}
private function consume(string $email, Request $request): bool
{
$bucketKey = $this->createBucketKey($email, $request->getClientIp());
$current = $this->counters[$bucketKey] ?? 0;
$this->counters[$bucketKey] = ++$current;
return 5 >= $current;
}
}