diff --git a/package.json b/package.json index 4af0052b..986ca4ab 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "sortpack" ] }, - "packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1", + "packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee", "engineStrict": true, "importSort": { ".js, .jsx, .ts, .tsx": { diff --git a/src/shared/components/community/community-form.tsx b/src/shared/components/community/community-form.tsx index 206fc841..49d402cc 100644 --- a/src/shared/components/community/community-form.tsx +++ b/src/shared/components/community/community-form.tsx @@ -14,6 +14,7 @@ import { ImageUploadForm } from "../common/image-upload-form"; import { LanguageSelect } from "../common/language-select"; import { MarkdownTextArea } from "../common/markdown-textarea"; import { tippyMixin } from "../mixins/tippy-mixin"; +import { validActorRegexPattern } from "../../config"; interface CommunityFormProps { community_view?: CommunityView; // If a community is given, that means this is an edit @@ -129,7 +130,7 @@ export class CommunityForm extends Component< onInput={linkEvent(this, this.handleCommunityNameChange)} required minLength={3} - pattern="[a-z0-9_]+" + pattern={validActorRegexPattern} title={I18NextService.i18n.t("community_reqs")} /> diff --git a/src/shared/components/home/signup.tsx b/src/shared/components/home/signup.tsx index 7c6c9471..beb14b93 100644 --- a/src/shared/components/home/signup.tsx +++ b/src/shared/components/home/signup.tsx @@ -11,7 +11,7 @@ import { LoginResponse, SiteView, } from "lemmy-js-client"; -import { joinLemmyUrl } from "../../config"; +import { joinLemmyUrl, validActorRegexPattern } from "../../config"; import { mdToHtml } from "../../markdown"; import { I18NextService, UserService } from "../../services"; import { @@ -166,7 +166,7 @@ export class Signup extends Component< onInput={linkEvent(this, this.handleRegisterUsernameChange)} required minLength={3} - pattern="[a-zA-Z0-9_]+" + pattern={validActorRegexPattern} title={I18NextService.i18n.t("community_reqs")} /> diff --git a/src/shared/config.ts b/src/shared/config.ts index 38e26613..8418ee8e 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -50,3 +50,6 @@ export const instanceLinkRegex = new RegExp( ); export const testHost = "0.0.0.0:8536"; + +export const validActorRegexPattern = + "^\\w+|[\\p{Script=Arabic}\\d_]+|[\\p{Script=Cyrillic}\\d_]+$";