From c3dd6a8efc07484a0b5ded2e91f3c9d15ca40ab4 Mon Sep 17 00:00:00 2001 From: elyseleong Date: Mon, 14 Oct 2024 22:23:08 +0800 Subject: [PATCH] Fix bug Bug: username must be edited in order to submit the form --- Frontend/src/components/user/EditProfile.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frontend/src/components/user/EditProfile.jsx b/Frontend/src/components/user/EditProfile.jsx index 9f4341b1b9..fac433543c 100644 --- a/Frontend/src/components/user/EditProfile.jsx +++ b/Frontend/src/components/user/EditProfile.jsx @@ -51,7 +51,7 @@ function EditProfile() { const usernameRegex = /^[a-zA-Z0-9._]{3,20}$/; const isValidUsername = usernameRegex.test(username) - if(!isValidUsername) { + if(!isValidUsername && username !== "") { console.log("username is not valid:", username) setUsernameError(true) setErrorMessage("Username can only contain letters, numbers, dots (.), and underscores (_), and must be between 3 and 20 characters long.")