From bd9e5bba51684db6bfa2a7a0c0af3f64cc4d7e49 Mon Sep 17 00:00:00 2001 From: Bauke Date: Thu, 5 Mar 2020 13:21:23 +0100 Subject: [PATCH] Fix: Properly validate usernames with greater/less and equal than. --- source/ts/utilities.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ts/utilities.ts b/source/ts/utilities.ts index 6de74ef..6670be2 100644 --- a/source/ts/utilities.ts +++ b/source/ts/utilities.ts @@ -287,8 +287,8 @@ export function flashMessage(message: string, error = false): void { // https://gitlab.com/tildes/tildes/blob/master/tildes/tildes/schemas/user.py export function isValidTildesUsername(username: string): boolean { return ( - username.length > 2 && - username.length < 20 && + username.length >= 3 && + username.length <= 20 && /^[a-z0-9]([a-z0-9]|[_-](?![_-]))*[a-z0-9]$/i.exec(username) !== null ); }