From db7aee369b199802ee436be7decd73cffffcfcb0 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 16 Nov 2025 23:09:18 +0000 Subject: [PATCH] Ensure credentials are trimmed when logging in. --- Marechai.App/Services/Authentication/AuthService.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Marechai.App/Services/Authentication/AuthService.cs b/Marechai.App/Services/Authentication/AuthService.cs index f69252ed..5b6390c3 100644 --- a/Marechai.App/Services/Authentication/AuthService.cs +++ b/Marechai.App/Services/Authentication/AuthService.cs @@ -19,9 +19,16 @@ public sealed class AuthService { if(credentials is null) return false; - string? email = credentials.FirstOrDefault(x => x.Key == "Email").Value; + string? email = + (credentials.FirstOrDefault(x => x.Key.Equals("Email", StringComparison.OrdinalIgnoreCase)).Value ?? + credentials.FirstOrDefault(x => x.Key.Equals("email", StringComparison.OrdinalIgnoreCase)).Value ?? + credentials.FirstOrDefault(x => x.Key.Equals("Username", StringComparison.OrdinalIgnoreCase)).Value) + ?.Trim(); - string? password = credentials.FirstOrDefault(x => x.Key == "Password").Value; + string? password = + (credentials.FirstOrDefault(x => x.Key.Equals("Password", StringComparison.OrdinalIgnoreCase)).Value ?? + credentials.FirstOrDefault(x => x.Key.Equals("password", StringComparison.OrdinalIgnoreCase)).Value) + ?.Trim(); if(email is null) {