From 6f77cb1b6d4043c27ea4bdbd515544b98eebeedb Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 5 Nov 2021 16:15:04 +0000 Subject: [PATCH] checking if tag name is valid when editing name. closes #2058 --- backend/api/controllers/user.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/api/controllers/user.js b/backend/api/controllers/user.js index b2cdcd006..d04d48d5b 100644 --- a/backend/api/controllers/user.js +++ b/backend/api/controllers/user.js @@ -244,6 +244,11 @@ class UserController { try { const { uid } = req.decodedToken; const { tagid, newname } = req.body; + if (!isTagPresetNameValid(newname)) + return res.status(400).json({ + message: + "Tag name invalid. Name cannot contain special characters or more than 16 characters. Can include _ . and -", + }); await UsersDAO.editTag(uid, tagid, newname); return res.sendStatus(200); } catch (e) {