From 2a32470758b4c3fcc1296bfad8df85ca6f54b303 Mon Sep 17 00:00:00 2001
From: jackiettran <41605212+jackiettran@users.noreply.github.com>
Date: Tue, 23 Dec 2025 23:08:22 -0500
Subject: [PATCH] text changes, error styling, navbar menu styling
---
backend/middleware/validation.js | 4 +-
backend/routes/auth.js | 6 +--
frontend/public/index.html | 2 +-
frontend/src/components/AuthModal.tsx | 38 ++++++++++++++++---
.../src/components/ForgotPasswordModal.tsx | 18 +++++++--
5 files changed, 52 insertions(+), 16 deletions(-)
diff --git a/backend/middleware/validation.js b/backend/middleware/validation.js
index 6e5530c..8235b6f 100644
--- a/backend/middleware/validation.js
+++ b/backend/middleware/validation.js
@@ -81,7 +81,7 @@ const validateRegistration = [
.withMessage("Password must be between 8 and 128 characters")
.matches(passwordStrengthRegex)
.withMessage(
- "Password must contain at least one uppercase letter, one lowercase letter, one number, and one special character"
+ "Password does not meet requirements"
)
.custom((value) => {
if (commonPasswords.includes(value.toLowerCase())) {
@@ -275,7 +275,7 @@ const validateResetPassword = [
.withMessage("Password must be between 8 and 128 characters")
.matches(passwordStrengthRegex)
.withMessage(
- "Password must contain at least one uppercase letter, one lowercase letter, one number, and one special character"
+ "Password does not meet requirements"
)
.custom((value) => {
if (commonPasswords.includes(value.toLowerCase())) {
diff --git a/backend/routes/auth.js b/backend/routes/auth.js
index 974fc48..1077fab 100644
--- a/backend/routes/auth.js
+++ b/backend/routes/auth.js
@@ -206,8 +206,7 @@ router.post(
if (!user) {
return res.status(401).json({
- error:
- "Unable to log in. Please check your email and password, or create an account.",
+ error: "Please check your email and password, or create an account.",
});
}
@@ -226,8 +225,7 @@ router.post(
// Increment login attempts
await user.incLoginAttempts();
return res.status(401).json({
- error:
- "Unable to log in. Please check your email and password, or create an account.",
+ error: "Please check your email and password, or create an account.",
});
}
diff --git a/frontend/public/index.html b/frontend/public/index.html
index e39260a..fe060ef 100644
--- a/frontend/public/index.html
+++ b/frontend/public/index.html
@@ -10,7 +10,7 @@
content="Village Share - Life is too expensive. Rent or borrow from your neighbors"
/>
-
Village Share - Community Rental Marketplace
+ Village Share
= ({
const handleEmailSubmit = async (e: React.FormEvent) => {
e.preventDefault();
- setLoading(true);
setError("");
+ // Custom validation to match app's error styling
+ if (mode === "signup") {
+ if (!firstName.trim()) {
+ setError("Please enter your first name");
+ return;
+ }
+ if (!lastName.trim()) {
+ setError("Please enter your last name");
+ return;
+ }
+ }
+
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+ if (!email.trim()) {
+ setError("Please enter your email address");
+ return;
+ }
+ if (!emailRegex.test(email)) {
+ setError("Please enter a valid email address");
+ return;
+ }
+
+ setLoading(true);
+
try {
if (mode === "login") {
await login(email, password);
@@ -132,7 +155,10 @@ const AuthModal: React.FC = ({
// Don't call onHide() - keep modal context for verification
}
} catch (err: any) {
- setError(err.response?.data?.error || "An error occurred");
+ // Show first specific validation error if available, otherwise generic error
+ const details = err.response?.data?.details;
+ const specificError = details?.[0]?.message;
+ setError(specificError || err.response?.data?.error || "An error occurred");
} finally {
setLoading(false);
}
@@ -202,7 +228,6 @@ const AuthModal: React.FC = ({
className="form-control"
value={firstName}
onChange={(e) => setFirstName(e.target.value)}
- required
/>