Add non-word character check
This commit is contained in:
parent
963eee0c4e
commit
4575843345
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user