summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErnest <ernestwisniewski2@gmail.com>2020-06-22 09:23:54 +0200
committerErnest <ernestwisniewski2@gmail.com>2020-06-22 09:23:54 +0200
commit8e1e9a521a17f8c7b52f71a00d4f38b2b7cb20e0 (patch)
treeb889dfbb4be495dcd85cc11a87c9990b750f1c05
parent4247df429591a83fb84bfab6f7850502e64858d8 (diff)
Edit community name validation, translations #823
-rw-r--r--server/src/api/community.rs4
-rw-r--r--ui/translations/en.json1
2 files changed, 5 insertions, 0 deletions
diff --git a/server/src/api/community.rs b/server/src/api/community.rs
index 2a517bb8..618122b9 100644
--- a/server/src/api/community.rs
+++ b/server/src/api/community.rs
@@ -311,6 +311,10 @@ impl Perform for Oper<EditCommunity> {
Err(_e) => return Err(APIError::err("not_logged_in").into()),
};
+ if !is_valid_community_name(&data.name) {
+ return Err(APIError::err("invalid_community_name").into());
+ }
+
let user_id = claims.id;
let conn = pool.get()?;
diff --git a/ui/translations/en.json b/ui/translations/en.json
index 87417223..a07da621 100644
--- a/ui/translations/en.json
+++ b/ui/translations/en.json
@@ -27,6 +27,7 @@
"number_of_communities": "{{count}} Community",
"number_of_communities_plural": "{{count}} Communities",
"community_reqs": "lowercase, underscores, and no spaces.",
+ "invalid_community_name": "Invalid name.",
"create_private_message": "Create Private Message",
"send_secure_message": "Send Secure Message",
"send_message": "Send Message",