login hcaptcha

This commit is contained in:
elvira
2026-09-25 16:19:56 +03:00
parent d43b615297
commit 3347febb3c
7 changed files with 118 additions and 16 deletions
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Rules\HCaptcha;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -43,8 +44,13 @@ public function create(string $locale, Request $request): View
public function send(string $locale, Request $request, UserOtpService $otp): RedirectResponse
{
// Captcha only here: verify() and resend() need the email this step
// puts in the session, so they can't be reached without passing it.
$validated = $request->validate([
'email' => ['required', 'email', 'max:255'],
'h-captcha-response' => ['bail', 'required', new HCaptcha],
], [
'h-captcha-response.required' => __('storefront.auth.captcha_failed'),
]);
$email = Str::lower(trim($validated['email']));