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

@@ -6,6 +6,7 @@ namespace App\Tests\Controller;
use App\Entity\User;
use App\Service\PasswordResetManager;
use App\Service\PublicFormRateLimiter;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Request;
@@ -65,6 +66,44 @@ class ResetPasswordControllerTest extends WebTestCase
self::assertStringContainsString('Du erhältst in Kürze eine E-Mail mit einem Link zum Zurücksetzen deines Passworts', $client->getResponse()->getContent());
}
public function testPasswordResetRequestReturns429WhenThrottled(): void
{
$client = self::createClient([], [
'HTTPS' => 'on',
]);
$client->disableReboot();
$email = sprintf('throttle-%[email protected]', bin2hex(random_bytes(4)));
$manager = $this->createMock(PasswordResetManager::class);
$manager
->expects(self::exactly(5))
->method('requestPasswordReset')
->with($email)
->willReturn(true);
self::getContainer()->set(PasswordResetManager::class, $manager);
for ($i = 0; $i < 5; ++$i) {
$crawler = $client->request('GET', '/reset-password');
$form = $crawler->selectButton('Passwort-Reset-Link anfordern')->form([
'form[email]' => $email,
]);
$client->submit($form);
self::assertResponseRedirects('/');
$client->followRedirect();
}
$crawler = $client->request('GET', '/reset-password');
$form = $crawler->selectButton('Passwort-Reset-Link anfordern')->form([
'form[email]' => $email,
]);
$client->submit($form);
self::assertResponseStatusCodeSame(429);
self::assertStringContainsString(PublicFormRateLimiter::THROTTLED_MESSAGE, $client->getResponse()->getContent());
}
public function testPasswordResetConfirmationDisplaysFormAndUpdatesPassword(): void
{
$client = self::createClient([], [