Add non-word character check

This commit is contained in:
regalijan 2023-10-19 16:51:02 -04:00
parent 963eee0c4e
commit 4575843345
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -78,7 +78,8 @@ export async function onRequestPost(context: RequestContext) {
if ( if (
username.length < 3 || username.length < 3 ||
username.length > 20 || username.length > 20 ||
username.match(/_/g)?.length > 1 username.match(/_/g)?.length > 1 ||
username.match(/\W/)
) )
return jsonError(`Username "${username}" is invalid`, 400); return jsonError(`Username "${username}" is invalid`, 400);
} }