Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/pages/Register.jsx
Browse files
frontend/src/pages/Register.jsx
CHANGED
|
@@ -27,6 +27,16 @@ export const Register = () => {
|
|
| 27 |
e.preventDefault();
|
| 28 |
setError('');
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
if (password !== confirmPassword) {
|
| 31 |
setError('Passwords do not match.');
|
| 32 |
return;
|
|
@@ -293,6 +303,7 @@ export const Register = () => {
|
|
| 293 |
className="peer w-5 h-5 appearance-none rounded-md border border-slate-300 bg-white checked:bg-blue-600 checked:border-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500/30 transition-all cursor-pointer"
|
| 294 |
id="terms"
|
| 295 |
type="checkbox"
|
|
|
|
| 296 |
checked={agreeTerms}
|
| 297 |
onChange={(e) => setAgreeTerms(e.target.checked)}
|
| 298 |
/>
|
|
|
|
| 27 |
e.preventDefault();
|
| 28 |
setError('');
|
| 29 |
|
| 30 |
+
if (!fullName.trim() || !companyName.trim() || !email.trim() || !password || !confirmPassword) {
|
| 31 |
+
setError('All fields are compulsory. Please fill in all required details.');
|
| 32 |
+
return;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
if (password.length < 8 || !/[A-Z]/.test(password) || !/[a-z]/.test(password) || !/[^A-Za-z0-9]/.test(password)) {
|
| 36 |
+
setError('Password must meet all 4 security requirements.');
|
| 37 |
+
return;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
if (password !== confirmPassword) {
|
| 41 |
setError('Passwords do not match.');
|
| 42 |
return;
|
|
|
|
| 303 |
className="peer w-5 h-5 appearance-none rounded-md border border-slate-300 bg-white checked:bg-blue-600 checked:border-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500/30 transition-all cursor-pointer"
|
| 304 |
id="terms"
|
| 305 |
type="checkbox"
|
| 306 |
+
required
|
| 307 |
checked={agreeTerms}
|
| 308 |
onChange={(e) => setAgreeTerms(e.target.checked)}
|
| 309 |
/>
|