Allow Arabic and Cyrillic characters when signing up or creating community (#2780)

* Allow Arabic and Cyrillic characters when signing up or creating community

* Fix mistake with escape

* Another escape mistake
This commit is contained in:
SleeplessOne1917 2024-10-29 09:15:21 -04:00
parent 7fafd34de8
commit 6cb4220201
4 changed files with 8 additions and 4 deletions

View file

@ -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": {

View file

@ -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")}
/>
</div>

View file

@ -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")}
/>
</div>

View file

@ -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_]+$";