Skip to content

Commit 4819807

Browse files
ArchitectVS7claude
andcommitted
fix(register): align password requirements with backend validation
Placeholder claimed min 8 chars; backend requires min 12 + special character. Added client-side validation to surface clear errors before form submission. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d59c542 commit 4819807

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

frontend/src/pages/RegisterPage.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ export default function RegisterPage() {
2222
return;
2323
}
2424

25+
if (password.length < 12) {
26+
setError('Password must be at least 12 characters');
27+
return;
28+
}
29+
if (!/[a-z]/.test(password) || !/[A-Z]/.test(password) || !/\d/.test(password) || !/[^a-zA-Z0-9]/.test(password)) {
30+
setError('Password must contain uppercase, lowercase, a digit, and a special character');
31+
return;
32+
}
33+
2534
setLoading(true);
2635
try {
2736
const res = await authApi.register({ email, password, name });
@@ -92,7 +101,7 @@ export default function RegisterPage() {
92101
value={password}
93102
onChange={(e) => setPassword(e.target.value)}
94103
className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent"
95-
placeholder="Min 8 chars, uppercase, lowercase, digit"
104+
placeholder="Min 12 chars, upper, lower, digit, symbol"
96105
/>
97106
</div>
98107

0 commit comments

Comments
 (0)