diff --git a/static/js/constants/name-patterns.constant.ts b/static/js/constants/name-patterns.constant.ts index 942028ee1e..0ed23ef074 100644 --- a/static/js/constants/name-patterns.constant.ts +++ b/static/js/constants/name-patterns.constant.ts @@ -2,7 +2,7 @@ * Regex patterns to for validating account names. */ export const NAME_PATTERNS: any = { - TEAM_PATTERN: '^[a-z][a-z0-9]+$', + TEAM_PATTERN: '^([a-z0-9]+(?:[._-][a-z0-9]+)*)$', ROBOT_PATTERN: '^[a-z][a-z0-9_]{1,254}$', USERNAME_PATTERN: '^(?=.{2,255}$)([a-z0-9]+(?:[._-][a-z0-9]+)*)$', }; diff --git a/web/src/routes/OrganizationsList/Organization/Tabs/DefaultPermissions/createPermissionDrawer/CreatePermissionDrawer.tsx b/web/src/routes/OrganizationsList/Organization/Tabs/DefaultPermissions/createPermissionDrawer/CreatePermissionDrawer.tsx index c70de93cae..afaa68b39c 100644 --- a/web/src/routes/OrganizationsList/Organization/Tabs/DefaultPermissions/createPermissionDrawer/CreatePermissionDrawer.tsx +++ b/web/src/routes/OrganizationsList/Organization/Tabs/DefaultPermissions/createPermissionDrawer/CreatePermissionDrawer.tsx @@ -166,7 +166,7 @@ export default function CreatePermissionDrawer( nameLabel="Provide a name for your new team:" descriptionLabel="Provide an optional description for your new team" helperText="Enter a description to provide extra information to your teammates about this team:" - nameHelperText="Choose a name to inform your teammates about this team. Must match ^[a-z][a-z0-9]+$." + nameHelperText="Choose a name to inform your teammates about this team. Must match ^([a-z0-9]+(?:[._-][a-z0-9]+)*)$" isModalOpen={isTeamModalOpen} handleModalToggle={() => setIsTeamModalOpen(!isTeamModalOpen)} handleWizardToggle={() => setIsTeamWizardOpen(!isTeamWizardOpen)} diff --git a/web/src/routes/OrganizationsList/Organization/Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx b/web/src/routes/OrganizationsList/Organization/Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx index 3268dcccf2..2da47c98c3 100644 --- a/web/src/routes/OrganizationsList/Organization/Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx +++ b/web/src/routes/OrganizationsList/Organization/Tabs/TeamsAndMembership/TeamsAndMembershipList.tsx @@ -54,7 +54,7 @@ export default function TeamsAndMembershipList() { nameLabel="Provide a name for your new team:" descriptionLabel="Provide an optional description for your new team" helperText="Enter a description to provide extra information to your teammates about this team:" - nameHelperText="Choose a name to inform your teammates about this team. Must match ^[a-z][a-z0-9]+$." + nameHelperText="Choose a name to inform your teammates about this team. Must match ^([a-z0-9]+(?:[._-][a-z0-9]+)*)$" isModalOpen={isTeamModalOpen} handleModalToggle={() => { setIsTeamModalOpen(!isTeamModalOpen); diff --git a/web/src/routes/RepositoryDetails/RepositoryDetails.tsx b/web/src/routes/RepositoryDetails/RepositoryDetails.tsx index 55a12402f4..27c9472bb2 100644 --- a/web/src/routes/RepositoryDetails/RepositoryDetails.tsx +++ b/web/src/routes/RepositoryDetails/RepositoryDetails.tsx @@ -125,7 +125,7 @@ export default function RepositoryDetails() { nameLabel="Provide a name for your new team:" descriptionLabel="Provide an optional description for your new team" helperText="Enter a description to provide extra information to your teammates about this team:" - nameHelperText="Choose a name to inform your teammates about this team. Must match ^[a-z][a-z0-9]+$." + nameHelperText="Choose a name to inform your teammates about this team. Must match ^([a-z0-9]+(?:[._-][a-z0-9]+)*)$" isModalOpen={isTeamModalOpen} handleModalToggle={() => setIsTeamModalOpen(!isTeamModalOpen)} validateName={validateTeamName}