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 committed by GitHub
parent 05362c8733
commit 8ba9bd22e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 4 deletions

View file

@ -145,7 +145,7 @@
"sortpack"
]
},
"packageManager": "pnpm@9.12.2+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228",
"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 {
@ -189,7 +189,7 @@ export class Signup extends Component<SignupRouteProps, State> {
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_]+$";