Case-insensitive email lookup in Telegram auth

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro
2026-07-14 18:49:55 +00:00
co-authored by Claude Sonnet 4.6
parent 3f2bdc0d47
commit bd421af05d
+3 -1
View File
@@ -206,12 +206,14 @@ class TelegramBotService
private function processEmail(string $chatId, string $email, string $nombre): void private function processEmail(string $chatId, string $email, string $nombre): void
{ {
$email = strtolower(trim($email));
if (! filter_var($email, FILTER_VALIDATE_EMAIL)) { if (! filter_var($email, FILTER_VALIDATE_EMAIL)) {
$this->send($chatId, "❌ Eso no parece un correo válido. Escríbelo de nuevo:"); $this->send($chatId, "❌ Eso no parece un correo válido. Escríbelo de nuevo:");
return; return;
} }
$user = User::where('email', $email)->first(); $user = User::whereRaw('LOWER(email) = ?', [$email])->first();
if (! $user) { if (! $user) {
$this->setState($chatId, [ $this->setState($chatId, [