diff --git a/app/src/.env.example b/app/src/.env.example index 4abeb3c..4c6a973 100644 --- a/app/src/.env.example +++ b/app/src/.env.example @@ -5,6 +5,11 @@ APP_DEBUG=true APP_TIMEZONE=UTC APP_URL=http://localhost +CAPTCHA_API_DOMAIN=http://your-domain-captcha-or-IP:8081 +CAPTCHA_PRIVATE_TOKEN= +CAPTCHA_STATIC_PATH=http://your-domain-captcha-or-IP:8081/captcha +CAPTCHA_PUBLIC_TOKEN= + APP_FORCE_HTTPS=false APP_DEFAULT_LOCALE=ru diff --git a/app/src/app/Http/Requests/AuthorizationRequest.php b/app/src/app/Http/Requests/AuthorizationRequest.php index ccba55c..934d9c8 100644 --- a/app/src/app/Http/Requests/AuthorizationRequest.php +++ b/app/src/app/Http/Requests/AuthorizationRequest.php @@ -16,6 +16,7 @@ final class AuthorizationRequest extends FormRequest implements FormRequestDto return [ 'email' => ['required', 'email', 'max:255'], 'password' => ['required', 'min:3'], + 'captcha-verified' => ['captcha'], 'remember' => ['nullable', 'boolean'], ]; } diff --git a/app/src/composer.json b/app/src/composer.json index 794615a..bee700a 100644 --- a/app/src/composer.json +++ b/app/src/composer.json @@ -6,6 +6,7 @@ "license": "MIT", "require": { "php": "^8.3", + "kor-elf/captcha-rule-for-laravel": "^1.0", "laravel/framework": "^11.0", "laravel/tinker": "^2.9" }, diff --git a/app/src/composer.lock b/app/src/composer.lock index c94b568..46f368c 100644 --- a/app/src/composer.lock +++ b/app/src/composer.lock @@ -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": "07ecc7069160d80fe08b7fb6758dab94", + "content-hash": "9e88c9e1f78fbf9527a1fc1d837b132d", "packages": [ { "name": "brick/math", @@ -1045,6 +1045,56 @@ ], "time": "2023-12-03T19:50:20+00:00" }, + { + "name": "kor-elf/captcha-rule-for-laravel", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://git.kor-elf.net/kor-elf/captcha-rule-for-laravel", + "reference": "b2c9242d51059bcd4275da6544134d8f28f08750" + }, + "require": { + "guzzlehttp/guzzle": "^7.0.1", + "illuminate/support": "^10.0|^11.0", + "php": "^8.2" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "korElf\\CaptchaRuleForLaravel\\CaptchaProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "korElf\\CaptchaRuleForLaravel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Leonid Nikitin", + "email": "i@kor-elf.net", + "homepage": "https://git.kor-elf.net/kor-elf", + "role": "Developer" + } + ], + "description": "Validation Rule Captcha for Laravel", + "homepage": "https://git.kor-elf.net/kor-elf/captcha-rule-for-laravel", + "keywords": [ + "captcha", + "laravel", + "validation" + ], + "time": "2024-04-02T17:36:12+00:00" + }, { "name": "laravel/framework", "version": "v11.1.1", diff --git a/app/src/lang/en/validation.php b/app/src/lang/en/validation.php index 1383ab9..0a85764 100644 --- a/app/src/lang/en/validation.php +++ b/app/src/lang/en/validation.php @@ -149,6 +149,7 @@ return [ 'url' => 'The :attribute must be a valid URL.', 'uuid' => 'The :attribute must be a valid UUID.', 'no_type' => 'The :attribute can only use: :type.', + 'captcha' => 'Failed to pass human verification.', 'attributes' => [ 'address' => 'address', 'affiliate_url' => 'affiliate URL', diff --git a/app/src/lang/ru/validation.php b/app/src/lang/ru/validation.php index 6d5f16e..3dd484b 100644 --- a/app/src/lang/ru/validation.php +++ b/app/src/lang/ru/validation.php @@ -149,6 +149,7 @@ return [ 'url' => 'Значение поля :attribute не является ссылкой или имеет некорректный формат.', 'uuid' => 'Значение поля :attribute должно быть корректным UUID.', 'no_type' => 'Значение поля :attribute может использовать только: :type.', + 'captcha' => 'Не удалось пройти проверку человеком.', 'attributes' => [ 'address' => 'адрес', 'affiliate_url' => 'Партнёрская ссылка', diff --git a/app/src/resources/views/login.blade.php b/app/src/resources/views/login.blade.php index 5920fad..311dd40 100644 --- a/app/src/resources/views/login.blade.php +++ b/app/src/resources/views/login.blade.php @@ -49,6 +49,9 @@ +