Я установил mewebstudio / captcha в своем приложении Laravel 7.6, но он всегда возвращал неверный захват, даже если я ввел правильное значение, я ввел текст в inpur. Пример: ввод https://prnt.sc/s8g03j и отправка формы: я получил
Invalid capture.
ошибка. Я пытаюсь отладить информацию и вижу результаты проверки запроса в
app/Http/Requests/ContactUsRequest.php with code :
public function rules()
{
$request = request();
$requestData = $request->all();
\Log::info( '-1 ContactUsRequest $requestData ::' . print_r( json_encode($requestData), true ) );
\Log::info( '-2 contacts_us_post $request->session()->all(); ::' . print_r( $request->session()->all(), true ) );
$a= ContactUs::getValidationRulesArray( [ 'skip_acceptor_id', 'skip_accepted'] );
\Log::info( '-2 ContactUsRequest $a ::' . print_r( $a, true ) );
return $a;
}
Когда правила определены в модели:
public static function getValidationRulesArray($options): array
{
$validationRulesArray = [
'author_name' => 'required|string|max:255',
'author_email' => 'required|email|max:255',
'message' => 'required',
'acceptor_id' => 'required|integer|exists:' . (with(new User)->getTable()) . ',id',
'accepted' => 'required|in:' . with(new ContactUs)->getValueLabelKeys(ContactUs::getContactUsAcceptedValueArray(false)),
'captcha' => 'required|captcha'
];
if (in_array('skip_acceptor_id', $options)) {
unset($validationRulesArray['acceptor_id']);
}
if (in_array('skip_accepted', $options)) {
unset($validationRulesArray['accepted']);
}
return $validationRulesArray;
}
Проверка журналов Я вижу:
[2020-04-30 10:29:12] local.INFO: -1 ContactUsRequest $requestData ::{"_token":"n8rVAUJhjg42hupGUntJZWwbOwzIcUmFYWna2e64","author_name":"account@yahoo.com","author_email":"accounty@yahoo.com","message":"text from account@yahoo.com lorem\r\nipsum","captcha":"qtee7n"}
[2020-04-30 10:29:12] local.INFO: -2 contacts_us_post $request->session()->all(); ::Array
(
[_token] => n8rVAUJhjg42hupGUntJZWwbOwzIcUmFYWna2e64
[_previous] => Array
(
[url] => http://local-votes.com/show_banner_image/1/PHP+site/php-logo.png/PHP+is+a+popular+scripting+language/2?dt=1588231599
)
[_flash] => Array
(
[old] => Array
(
)
[new] => Array
(
)
)
[captcha] => Array
(
[sensitive] =>
[key] => $2y$10$6t2.cC8CAPOd8JS8ZfcnUOeZr0RzD2eIDylRYurg41or1TpiEn7oS
)
[votes_register] => Array
(
[username] => JackParrot
[email] => JackParrot@mail.com
[password] => 111111
[first_name] => Jack
[last_name] => Parrot
[phone] => 098-765-4321
[website] => jackparrot.vote_site.com
[notes] =>
[sex] => M
[selectedSubscriptions] => Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[0] =>
[1] => 1
[2] => 2
)
)
)
)
[2020-04-30 10:29:12] local.INFO: -2 ContactUsRequest $a ::Array
(
[author_name] => required|string|max:255
[author_email] => required|email|max:255
[message] => required
[captcha] => required|captcha
)
Я вижу свои введенные данные в запросе и данные капчи в сеансе с ключом и не вижу ошибки в коде кода капчи. Я пропустил некоторые варианты?
Мой composer. json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.2.5",
"alaouy/youtube": "^2.2",
"aloha/twilio": "^4.0",
"arrilot/laravel-widgets": "^3.12",
"cornford/googlmapper": "^3.2.1",
"cviebrock/eloquent-sluggable": "^7.0",
"davejamesmiller/laravel-breadcrumbs": "5.x",
"doctrine/dbal": "^2.8",
"facebook/graph-sdk": "^5.7",
"fideloper/proxy": "^4.0",
"google/apiclient": "^2.4.1",
"guzzlehttp/guzzle": "6.5.x-dev",
"intervention/image": "^2.4",
"itsgoingd/clockwork": "^3.0",
"jrean/laravel-user-verification": "dev-master",
"laravel/cashier": "^10.3",
"laravel/framework": "^7.0",
"laravel/passport": "^8.4",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"laravelium/sitemap": "7.0.1",
"maatwebsite/excel": "^3.1",
"mews/captcha": "^3.1",
"mews/purifier": "3.2.0",
"paypal/rest-api-sdk-php": "*",
"pelago/emogrifier": "3.1.0",
"proengsoft/laravel-jsvalidation": ">2.2.0",
"qlick/laravel-full-calendar": "~1.0",
"s-ichikawa/laravel-sendgrid-driver": "~2.0",
"snowfire/beautymail": "dev-master",
"spatie/browsershot": "^3.27",
"spatie/db-dumper": "^2.14",
"spatie/laravel-activitylog": "^3.1",
"spatie/laravel-backup": "^6.1",
"spatie/laravel-feed": "^2.1",
"spatie/laravel-image-optimizer": "^1.4",
"spatie/laravel-newsletter": "^4.2",
"spatie/laravel-sitemap": "^5.3",
"spatie/laravel-tags": "^2.1",
"spipu/html2pdf": "^5.2",
"stripe/stripe-php": "^7.2",
"symfony/psr-http-message-bridge": "^1.2",
"themsaid/laravel-mail-preview": "dev-master",
"unisharp/laravel-filemanager": "^1.9",
"wboyz/laravel-enum": "^0.2.1",
"willvincent/feeds": "dev-master",
"yajra/laravel-datatables-oracle": "^9.0.0",
"zendframework/zend-diactoros": "^2.1"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.1",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "4.1",
"orangehill/iseed": "^2.6",
"phpunit/phpunit": "^8.5"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/jeremykenedy/Generators-1.git"
}
],
"autoload": {
"files": [
"app/helper.php"
],
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
],
"post-update-cmd": [
"php artisan vendor:publish --provider=\"Proengsoft\\JsValidation\\JsValidationServiceProvider\" --tag=public --force"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}