Merge pull request #1506 from matrix-org/dbkr/group_id_alphanum

Add clientside error for non-alphanumeric group ID
pull/21833/head
David Baker 2017-10-19 16:43:16 +01:00 committed by GitHub
commit 0f4ca1992d
2 changed files with 6 additions and 1 deletions

View File

@ -66,8 +66,12 @@ export default React.createClass({
{domain: MatrixClientPeg.get().getDomain()},
);
} else {
const groupId = parsedGroupId[0];
const domain = parsedGroupId[1];
if (domain !== MatrixClientPeg.get().getDomain()) {
if (!/^[a-zA-Z0-9]*$/.test(groupId)) {
error = _t("Community IDs may only contain alphanumeric characters");
} else if (domain !== MatrixClientPeg.get().getDomain()) {
error = _t(
"It is currently only possible to create communities on your own home server: "+
"use a community ID ending with %(domain)s",

View File

@ -583,6 +583,7 @@
"Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.": "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.",
"%(actionVerb)s this person?": "%(actionVerb)s this person?",
"Community IDs must be of the form +localpart:%(domain)s": "Community IDs must be of the form +localpart:%(domain)s",
"Community IDs may only contain alphanumeric characters": "Community IDs may only contain alphanumeric characters",
"It is currently only possible to create communities on your own home server: use a community ID ending with %(domain)s": "It is currently only possible to create communities on your own home server: use a community ID ending with %(domain)s",
"Room creation failed": "Room creation failed",
"Create Community": "Create Community",