Skip to content

Commit 5f93fc3

Browse files
committed
loosen name regex
1 parent 2be416e commit 5f93fc3

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/components/InstitutionInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { IconHomeLine, TextInput } from "@instructure/ui";
22
import type React from "react";
33
import type { SyntheticEvent } from "react";
4-
import { NamePattern, SpacePattern } from "../utils/RegEx";
4+
import { SpacePattern } from "../utils/RegEx";
55
import type { SignupFormInputProps } from "./SignupForm";
66

77
const InstitutionInput: React.FC<SignupFormInputProps> = ({
@@ -12,7 +12,7 @@ const InstitutionInput: React.FC<SignupFormInputProps> = ({
1212
setMessages,
1313
}) => {
1414
const isInvalidInstitution = (name: string): boolean => {
15-
return !NamePattern.test(name) || SpacePattern.test(name);
15+
return SpacePattern.test(name);
1616
};
1717

1818
const handleChange = (

src/components/NameInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { IconUserLine, TextInput } from "@instructure/ui";
22
import type React from "react";
33
import type { SyntheticEvent } from "react";
4-
import { NamePattern, SpacePattern } from "../utils/RegEx";
4+
import { SpacePattern } from "../utils/RegEx";
55
import type { SignupFormInputProps } from "./SignupForm";
66

77
const NameInput: React.FC<SignupFormInputProps> = ({
@@ -12,7 +12,7 @@ const NameInput: React.FC<SignupFormInputProps> = ({
1212
setMessages,
1313
}) => {
1414
const isInvalidName = (name: string): boolean => {
15-
return !NamePattern.test(name) || SpacePattern.test(name);
15+
return SpacePattern.test(name);
1616
};
1717

1818
const handleChange = (

src/utils/RegEx.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const EmailAddressPattern: RegExp =
22
/^[\w.!#$%&'*+/=?^`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*$/i;
33
const PersonalEmailPattern: RegExp =
44
/@(gmail|yahoo|outlook|hotmail|aol|icloud|mail|protonmail|zoho|yandex)\.com$/i;
5-
const NamePattern: RegExp = /^[\p{L}\p{M}'\-. &]+$/u;
65
const SpacePattern: RegExp = /^[ \t]+$/;
76

8-
export { EmailAddressPattern, PersonalEmailPattern, NamePattern, SpacePattern };
7+
export { EmailAddressPattern, PersonalEmailPattern, SpacePattern };

0 commit comments

Comments
 (0)