From fc228d4cd3a26f4865799f45a70abbfe6dfc029e Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Wed, 10 Sep 2025 11:23:36 +0530 Subject: [PATCH] Username and Password Fields Should Auto-Trim Spaces on Login --- src/pages/authentication/LoginPage.jsx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/pages/authentication/LoginPage.jsx b/src/pages/authentication/LoginPage.jsx index 9240e33d..0bf01429 100644 --- a/src/pages/authentication/LoginPage.jsx +++ b/src/pages/authentication/LoginPage.jsx @@ -16,13 +16,13 @@ const LoginPage = () => { const loginSchema = IsLoginWithOTP ? z.object({ - username: z.string().email({ message: "Valid email required" }), - }) + username: z.string().trim().email({ message: "Valid email required" }), + }) : z.object({ - username: z.string().email({ message: "Valid email required" }), - password: z.string().min(1, { message: "Password required" }), - rememberMe: z.boolean(), - }); + username: z.string().trim().email({ message: "Valid email required" }), + password: z.string().trim().min(1, { message: "Password required" }), + rememberMe: z.boolean(), + }); const { register, @@ -114,9 +114,8 @@ const LoginPage = () => { @@ -169,8 +168,8 @@ const LoginPage = () => { {loading ? "Please Wait..." : IsLoginWithOTP - ? "Send OTP" - : "Sign In"} + ? "Send OTP" + : "Sign In"} {/* Login With OTP Button */}