Skip to content

OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free.

Improve email validation regex in sign-in form

Mr. Algorithm973e1d65ae53
diff --git a/app/(auth)/sign-in/page.tsx b/app/(auth)/sign-in/page.tsx
index 9964a67..9c61c53 100644
--- a/app/(auth)/sign-in/page.tsx
+++ b/app/(auth)/sign-in/page.tsx
@@ -54,7 +54,13 @@ const SignIn = () => {
placeholder="[email protected]"
register={register}
error={errors.email}
- validation={{ required: 'Email is required', pattern: /^\w+@\w+\.\w+$/ }}
+ validation={{
+ required: 'Email is required',
+ pattern: {
+ value: /^[\w-.]+@([\w-]+\.)+[\w-]{2,}$/,
+ message: 'Please enter a valid email address'
+ }
+ }}
/>
<InputField
@@ -77,4 +83,4 @@ const SignIn = () => {
</>
);
};
-export default SignIn;
\ No newline at end of file
+export default SignIn;