⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
hospital.dev-unit.com
/
app
/
Rules
/
View File Name :
ValidRecaptcha.php
<?php namespace App\Rules; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; use Illuminate\Contracts\Validation\Rule; class ValidRecaptcha implements Rule { /** * @param string * @param mixed $value * * @throws GuzzleException */ public function passes($attribute, $value): bool { // Validate ReCaptcha $client = new Client([ 'base_uri' => 'https://google.com/recaptcha/api/', ]); $response = $client->post('siteverify', [ 'query' => [ 'secret' => getSuperAdminSettingKeyValue('google_captcha_secret'), 'response' => $value, ], ]); return json_decode($response->getBody())->success; } /** * Get the validation error message. */ public function message(): string { return __('messages.new_change.captcha_verification_failed'); } }