added rate limiter for log in

This commit is contained in:
Charles 2025-12-15 14:16:14 +01:00
parent 0b8890e3d7
commit 12f2b39ccd
7 changed files with 83 additions and 2 deletions

View File

@ -18,6 +18,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/mtdowling/jmespath.php" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-client" />
<excludeFolder url="file://$MODULE_DIR$/vendor/ralouphie/getallheaders" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/rate-limiter" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

View File

@ -180,6 +180,7 @@
<path value="$PROJECT_DIR$/vendor/psr/http-client" />
<path value="$PROJECT_DIR$/vendor/twig/extra-bundle" />
<path value="$PROJECT_DIR$/vendor/staabm/side-effects-detector" />
<path value="$PROJECT_DIR$/vendor/symfony/rate-limiter" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.2" />

View File

@ -39,6 +39,7 @@
"symfony/process": "7.2.*",
"symfony/property-access": "7.2.*",
"symfony/property-info": "7.2.*",
"symfony/rate-limiter": "7.2.*",
"symfony/runtime": "7.2.*",
"symfony/security-bundle": "7.2.*",
"symfony/serializer": "7.2.*",

76
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1b2e89b80b579953618c7e61c6b76560",
"content-hash": "00e62b0a959e7b09d4b1fdb7e0501549",
"packages": [
{
"name": "aws/aws-crt-php",
@ -7684,6 +7684,80 @@
],
"time": "2024-09-26T08:57:56+00:00"
},
{
"name": "symfony/rate-limiter",
"version": "v7.2.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/rate-limiter.git",
"reference": "daae5da398aca84809aa6088371314a9cb88b42e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/rate-limiter/zipball/daae5da398aca84809aa6088371314a9cb88b42e",
"reference": "daae5da398aca84809aa6088371314a9cb88b42e",
"shasum": ""
},
"require": {
"php": ">=8.2",
"symfony/options-resolver": "^6.4|^7.0"
},
"require-dev": {
"psr/cache": "^1.0|^2.0|^3.0",
"symfony/lock": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\RateLimiter\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Wouter de Jong",
"email": "wouter@wouterj.nl"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides a Token Bucket implementation to rate limit input and output in your application",
"homepage": "https://symfony.com",
"keywords": [
"limiter",
"rate-limiter"
],
"support": {
"source": "https://github.com/symfony/rate-limiter/tree/v7.2.9"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2025-07-10T08:29:33+00:00"
},
{
"name": "symfony/routing",
"version": "v7.2.9",

View File

@ -42,6 +42,9 @@ security:
user_checker: App\Security\UserChecker
lazy: true
provider: app_user_provider
login_throttling:
max_attempts: 3
interval: '1 minute'
form_login:
login_path: app_login
check_path: app_login

View File

@ -1,5 +1,5 @@
framework:
default_locale: en
default_locale: fr
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:

View File

@ -0,0 +1 @@
"Too many failed login attempts, please try again later.": "Trop de tentatives de connexion. Veuillez réessayer plus tard."