diff --git a/.changeset/wet-hotels-bow.md b/.changeset/wet-hotels-bow.md new file mode 100644 index 00000000..405ad920 --- /dev/null +++ b/.changeset/wet-hotels-bow.md @@ -0,0 +1,5 @@ +--- +"@slashid/react": patch +--- + +Normalise the email before validation diff --git a/packages/react/src/components/form/authenticating/validation.test.ts b/packages/react/src/components/form/authenticating/validation.test.ts index 4a7fa1f5..1327eb7a 100644 --- a/packages/react/src/components/form/authenticating/validation.test.ts +++ b/packages/react/src/components/form/authenticating/validation.test.ts @@ -102,4 +102,9 @@ describe.concurrent("validation tests", () => { it("should be invalid phone number", () => { expect(isValidPhoneNumber("")).toBe(false); }); + + it("should allow mixed case", () => { + expect(isValidEmail("JEssica.e@h.com")).toBe(true); + expect(isValidEmail("Jessica.E@h.com")).toBe(true); + }); }); diff --git a/packages/react/src/components/form/authenticating/validation.ts b/packages/react/src/components/form/authenticating/validation.ts index 334a94f2..93f094a7 100644 --- a/packages/react/src/components/form/authenticating/validation.ts +++ b/packages/react/src/components/form/authenticating/validation.ts @@ -22,7 +22,7 @@ export const isValidEmail: ValidatorFn = (value) => { return false; } - return EMAIL_REGEX.test(value); + return EMAIL_REGEX.test(value.toLowerCase()); }; export const isValidUsername: ValidatorFn = (value) => {