From 601b0324b80a1d618e9e53978d7ce9baf2672b4a Mon Sep 17 00:00:00 2001 From: sageTheDM Date: Tue, 8 Oct 2024 07:22:09 +0200 Subject: [PATCH] Removed the empty account creation bug --- app/components/Login.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/components/Login.tsx b/app/components/Login.tsx index a2c0f7f..146e86c 100644 --- a/app/components/Login.tsx +++ b/app/components/Login.tsx @@ -79,12 +79,16 @@ const Login: React.FC = () => { // Function to handle account creation const handleCreateAccount = async () => { - const success = await createAccount(newAccountName, newAccountEmail, newAccountPassword); - if (success) { - alert('Account created successfully! You can now log in.'); - toggleSignUpPopup(); // Close sign-up popup + if (newAccountName !== "" && newAccountEmail !== "" && newAccountPassword !== "") { + const success = await createAccount(newAccountName, newAccountEmail, newAccountPassword); + if (success) { + alert('Account created successfully! You can now log in.'); + toggleSignUpPopup(); // Close sign-up popup + } else { + alert('Account creation failed. Please try again.'); + } } else { - alert('Account creation failed. Please try again.'); + alert('Account creation failed. Please do not leave any field empty.'); } };