From 36bf56b62250abe4d344683fbabbf31085dc7b26 Mon Sep 17 00:00:00 2001 From: Juan Felipe Duarte Date: Mon, 2 Mar 2026 08:43:12 -0500 Subject: [PATCH] Normalize email input for registration and login Trim and lowercase email before storing or attempting login to avoid mismatches from case or surrounding whitespace. Updated RegisteredUserController@store to save 'email' => strtolower(trim($request->email)) and LoginRequest@authenticate to call Auth::attempt with the normalized email input. --- app/Http/Controllers/Auth/RegisteredUserController.php | 2 +- app/Http/Requests/Auth/LoginRequest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.php index 5b6c28b..c0d2565 100755 --- a/app/Http/Controllers/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Auth/RegisteredUserController.php @@ -67,7 +67,7 @@ class RegisteredUserController extends Controller $user = User::create([ 'name' => $request->name, - 'email' => $request->email, + 'email' => strtolower(trim($request->email)), 'password' => Hash::make($request->password), 'rol_id' => $rol_id, 'parent_id' => $referralUser ? $referralUser->id : null, diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.php index e0c6f14..b91dc6c 100755 --- a/app/Http/Requests/Auth/LoginRequest.php +++ b/app/Http/Requests/Auth/LoginRequest.php @@ -45,7 +45,7 @@ class LoginRequest extends FormRequest { $this->ensureIsNotRateLimited(); - if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { + if (! Auth::attempt(['email' => strtolower(trim($this->input('email'))), 'password' => $this->input('password')], $this->boolean('remember'))) { RateLimiter::hit($this->throttleKey()); throw ValidationException::withMessages([