diff --git a/frontend/src/pages/LoginPage.jsx b/frontend/src/pages/LoginPage.jsx index d3acd3b..eca3894 100644 --- a/frontend/src/pages/LoginPage.jsx +++ b/frontend/src/pages/LoginPage.jsx @@ -149,4 +149,4 @@ export default function LoginPage() {

); -} \ No newline at end of file +} diff --git a/frontend/src/pages/RegisterPage.jsx b/frontend/src/pages/RegisterPage.jsx index 781a520..ca04cc2 100644 --- a/frontend/src/pages/RegisterPage.jsx +++ b/frontend/src/pages/RegisterPage.jsx @@ -5,8 +5,8 @@ import PasswordInput from '../components/PasswordInput'; import { HiMail, HiArrowRight, HiCheckCircle, HiXCircle } from 'react-icons/hi'; export default function RegisterPage() { - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); const [errors, setErrors] = useState({}); const [serverError, setServerError] = useState(''); const [isLoading, setIsLoading] = useState(false); @@ -38,31 +38,32 @@ export default function RegisterPage() { const newErrors = {}; const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if (!emailRegex.test(email)) { - newErrors.email = 'Please enter a valid email address.'; + newErrors.email = "Please enter a valid email address."; } else { // Frontend blacklist for instant feedback - const domain = email.split('@')[1]; - const blockedDomains = ['example.com', 'test.com', 'invalid.com']; + const domain = email.split("@")[1]; + const blockedDomains = ["example.com", "test.com", "invalid.com"]; if (blockedDomains.includes(domain)) { - newErrors.email = 'This email domain is not allowed.'; + newErrors.email = "This email domain is not allowed."; } } if (password.length < 8 || password.length > 16) { - newErrors.password = 'Password must be 8-16 characters long.'; + newErrors.password = "Password must be 8-16 characters long."; } else { const passwordRegex = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[\W_])/; if (!passwordRegex.test(password)) { - newErrors.password = 'Password must contain an alphabet, a digit, and a symbol.'; + newErrors.password = + "Password must contain an alphabet, a digit, and a symbol."; } } - + return newErrors; }; const handleSubmit = async (e) => { e.preventDefault(); - setServerError(''); + setServerError(""); // Clear previous server errors const validationErrors = validate(); if (Object.keys(validationErrors).length > 0) { setErrors(validationErrors); @@ -262,4 +263,4 @@ export default function RegisterPage() {

); -} \ No newline at end of file +}