Compare commits
No commits in common. "a1e687154d9c94992e8cea20a0ecc9fc2467f726" and "c2cc4202a7fec4b38cf95b112b011dfd22392aa6" have entirely different histories.
a1e687154d
...
c2cc4202a7
28
src/App.tsx
28
src/App.tsx
|
|
@ -299,30 +299,6 @@ export default function App() {
|
||||||
setAuthError(null);
|
setAuthError(null);
|
||||||
|
|
||||||
const endpoint = authMode === 'login' ? '/api/auth/login' : '/api/auth/register';
|
const endpoint = authMode === 'login' ? '/api/auth/login' : '/api/auth/register';
|
||||||
|
|
||||||
if (authMode === 'register') {
|
|
||||||
if (authPassword.length < 8) {
|
|
||||||
setAuthError('Password must be at least 8 characters long.');
|
|
||||||
setAuthLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!/[A-Z]/.test(authPassword)) {
|
|
||||||
setAuthError('Password must contain at least one uppercase letter.');
|
|
||||||
setAuthLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!/[0-9]/.test(authPassword)) {
|
|
||||||
setAuthError('Password must contain at least one number.');
|
|
||||||
setAuthLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!/[^A-Za-z0-9\s]/.test(authPassword)) {
|
|
||||||
setAuthError('Password must contain at least one special character.');
|
|
||||||
setAuthLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const fullPhone = authPhone ? `${authDialCode}${authPhone}` : undefined;
|
const fullPhone = authPhone ? `${authDialCode}${authPhone}` : undefined;
|
||||||
const payload = authMode === 'login'
|
const payload = authMode === 'login'
|
||||||
? { email: authEmail, password: authPassword }
|
? { email: authEmail, password: authPassword }
|
||||||
|
|
@ -376,7 +352,7 @@ export default function App() {
|
||||||
setChangePasswordError('New password must contain at least one number.');
|
setChangePasswordError('New password must contain at least one number.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!/[^A-Za-z0-9\s]/.test(changeNewPassword)) {
|
if (!/[^A-Za-z0-9]/.test(changeNewPassword)) {
|
||||||
setChangePasswordError('New password must contain at least one special character.');
|
setChangePasswordError('New password must contain at least one special character.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -447,7 +423,7 @@ export default function App() {
|
||||||
setAuthLoading(false);
|
setAuthLoading(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!/[^A-Za-z0-9\s]/.test(resetNewPassword)) {
|
if (!/[^A-Za-z0-9]/.test(resetNewPassword)) {
|
||||||
setAuthError('New password must contain at least one special character.');
|
setAuthError('New password must contain at least one special character.');
|
||||||
setAuthLoading(false);
|
setAuthLoading(false);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ export const ProfileDrawer: React.FC<ProfileDrawerProps> = ({
|
||||||
<span className={/[0-9]/.test(changeNewPassword) ? 'text-emerald-600 font-bold' : ''}>
|
<span className={/[0-9]/.test(changeNewPassword) ? 'text-emerald-600 font-bold' : ''}>
|
||||||
• 1 number
|
• 1 number
|
||||||
</span>
|
</span>
|
||||||
<span className={/[^A-Za-z0-9\s]/.test(changeNewPassword) ? 'text-emerald-600 font-bold' : ''}>
|
<span className={/[^A-Za-z0-9]/.test(changeNewPassword) ? 'text-emerald-600 font-bold' : ''}>
|
||||||
• 1 special char
|
• 1 special char
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue