Skip to content

Commit e6305e4

Browse files
committed
refactor: use email regex constant
1 parent 3c4a54b commit e6305e4

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/components/Login/CompleteSignupFormFields/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
EMAIL_REGEX,
23
getEmailField as getOriginalEmailField,
34
getUsernameField as getOriginalUsernameField,
45
} from '../SignUpFormFields/credentialFields';
@@ -7,9 +8,6 @@ import { getNameFields } from '../SignUpFormFields/nameFields';
78
import { FormBuilderFormField } from '@/components/FormBuilder/FormBuilderTypes';
89
import { RuleType } from '@/types/FieldRule';
910

10-
// Simple email validation regex for the complete signup form
11-
const EMAIL_REGEX = '.+@.+..+';
12-
1311
/**
1412
* Creates a modified field with updated properties for the complete signup form
1513
* @param {FormBuilderFormField} field - The original field

src/components/Login/SignUpFormFields/credentialFields.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { FormBuilderFormField } from '@/components/FormBuilder/FormBuilderTypes'
55
import { RuleType } from '@/types/FieldRule';
66
import { FormFieldType } from '@/types/FormField';
77

8-
const EMAIL_REGEX =
8+
export const EMAIL_REGEX =
99
'^(([^<>()[\\]\\\\.,;:\\s@"]+(\\.[^<>()[\\]\\\\.,;:\\s@"]+)*)|(".+"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\\.)+[a-zA-Z]{2,}))$';
1010

1111
export const REGEX_USERNAME = '^[a-zA-Z0-9_]+$';

0 commit comments

Comments
 (0)