Added a captcha for login.

This commit is contained in:
Leonid Nikitin 2024-04-02 23:21:23 +05:00
parent e8e9e50162
commit c96dabbd09
Signed by: kor-elf
GPG Key ID: 3C0F720C170F6E1D
7 changed files with 63 additions and 1 deletions

View File

@ -5,6 +5,11 @@ APP_DEBUG=true
APP_TIMEZONE=UTC APP_TIMEZONE=UTC
APP_URL=http://localhost 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_FORCE_HTTPS=false
APP_DEFAULT_LOCALE=ru APP_DEFAULT_LOCALE=ru

View File

@ -16,6 +16,7 @@ final class AuthorizationRequest extends FormRequest implements FormRequestDto
return [ return [
'email' => ['required', 'email', 'max:255'], 'email' => ['required', 'email', 'max:255'],
'password' => ['required', 'min:3'], 'password' => ['required', 'min:3'],
'captcha-verified' => ['captcha'],
'remember' => ['nullable', 'boolean'], 'remember' => ['nullable', 'boolean'],
]; ];
} }

View File

@ -6,6 +6,7 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^8.3", "php": "^8.3",
"kor-elf/captcha-rule-for-laravel": "^1.0",
"laravel/framework": "^11.0", "laravel/framework": "^11.0",
"laravel/tinker": "^2.9" "laravel/tinker": "^2.9"
}, },

52
app/src/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "07ecc7069160d80fe08b7fb6758dab94", "content-hash": "9e88c9e1f78fbf9527a1fc1d837b132d",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -1045,6 +1045,56 @@
], ],
"time": "2023-12-03T19:50:20+00:00" "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", "name": "laravel/framework",
"version": "v11.1.1", "version": "v11.1.1",

View File

@ -149,6 +149,7 @@ return [
'url' => 'The :attribute must be a valid URL.', 'url' => 'The :attribute must be a valid URL.',
'uuid' => 'The :attribute must be a valid UUID.', 'uuid' => 'The :attribute must be a valid UUID.',
'no_type' => 'The :attribute can only use: :type.', 'no_type' => 'The :attribute can only use: :type.',
'captcha' => 'Failed to pass human verification.',
'attributes' => [ 'attributes' => [
'address' => 'address', 'address' => 'address',
'affiliate_url' => 'affiliate URL', 'affiliate_url' => 'affiliate URL',

View File

@ -149,6 +149,7 @@ return [
'url' => 'Значение поля :attribute не является ссылкой или имеет некорректный формат.', 'url' => 'Значение поля :attribute не является ссылкой или имеет некорректный формат.',
'uuid' => 'Значение поля :attribute должно быть корректным UUID.', 'uuid' => 'Значение поля :attribute должно быть корректным UUID.',
'no_type' => 'Значение поля :attribute может использовать только: :type.', 'no_type' => 'Значение поля :attribute может использовать только: :type.',
'captcha' => 'Не удалось пройти проверку человеком.',
'attributes' => [ 'attributes' => [
'address' => 'адрес', 'address' => 'адрес',
'affiliate_url' => 'Партнёрская ссылка', 'affiliate_url' => 'Партнёрская ссылка',

View File

@ -49,6 +49,9 @@
</label> </label>
</div> </div>
</div> </div>
<div class="form-group mb-4">
@captcha
</div>
</div> </div>
<div class="d-grid"> <div class="d-grid">
<button type="submit" class="btn btn-gray-800">{{ __('Sign in') }}</button> <button type="submit" class="btn btn-gray-800">{{ __('Sign in') }}</button>