Compare commits

...

2 commits

Author SHA1 Message Date
hippoz
706372716e
frontend: add maxlength and minlength to channel edit and create modals 2022-04-26 04:04:55 +03:00
hippoz
444fcb2087
backend: fix channel name length limits 2022-04-26 04:04:40 +03:00
3 changed files with 4 additions and 4 deletions

View file

@ -37,7 +37,7 @@
<label class="input-label">
Channel Name
<input class="input full-width" bind:value={ channelName } />
<input class="input full-width" minlength="1" maxlength="32" bind:value={ channelName } />
</label>
<div class="modal-footer">

View file

@ -53,7 +53,7 @@
<label class="input-label">
Channel Name
<input class="input full-width" bind:value={ channelName } />
<input class="input full-width" minlength="1" maxlength="32" bind:value={ channelName } />
</label>
<div class="modal-footer">

View file

@ -12,7 +12,7 @@ const router = express.Router();
router.post(
"/",
authenticateRoute(),
body("name").isLength({ min: 1, max: 40 }).isAlphanumeric("en-US", { ignore: " _-" }),
body("name").isLength({ min: 1, max: 32 }).isAlphanumeric("en-US", { ignore: " _-" }),
async (req, res) => {
const validationErrors = validationResult(req);
if (!validationErrors.isEmpty()) {
@ -43,7 +43,7 @@ router.post(
router.put(
"/:id",
authenticateRoute(),
body("name").isLength({ min: 1, max: 40 }).isAlphanumeric("en-US", { ignore: " _-" }),
body("name").isLength({ min: 1, max: 32 }).isAlphanumeric("en-US", { ignore: " _-" }),
param("id").isNumeric(),
async (req, res) => {
const validationErrors = validationResult(req);