feat(Contact & membership forms update with their notification)
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 26h10m46s
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 26h10m46s
This commit is contained in:
21
app/Rules/ValidCaptcha.php
Normal file
21
app/Rules/ValidCaptcha.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class ValidCaptcha implements ValidationRule
|
||||
{
|
||||
public function __construct(private readonly string $sessionKey = 'captcha_answer') {}
|
||||
|
||||
/**
|
||||
* @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
if (trim((string) $value) !== (string) session($this->sessionKey)) {
|
||||
$fail('Le code de vérification est incorrect.');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user