diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-02-02 22:15:03 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-02 22:15:03 +1100 |
commit | af6b5a6594856794573ff700c5ea388e4cc4500d (patch) | |
tree | 65a007c2a28abdbca6ea35e1f048158af98125da /src/api/routes/users/@me/index.ts | |
parent | Use erlpack instead of @yukikaze-bot/erlpack (#968) (diff) | |
download | server-af6b5a6594856794573ff700c5ea388e4cc4500d.tar.xz |
Merge pull request from GHSA-r7h4-76f7-6264
* Actually use maxUsername config value. * Change maxUsername default to discord.com default
Diffstat (limited to 'src/api/routes/users/@me/index.ts')
-rw-r--r-- | src/api/routes/users/@me/index.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/api/routes/users/@me/index.ts b/src/api/routes/users/@me/index.ts index 0d3c3135..30091344 100644 --- a/src/api/routes/users/@me/index.ts +++ b/src/api/routes/users/@me/index.ts @@ -129,6 +129,16 @@ router.patch( }, }); } + + const { maxUsername } = Config.get().limits.user; + if (check_username.length > maxUsername) { + throw FieldErrors({ + username: { + code: "USERNAME_INVALID", + message: `Username must be less than ${maxUsername} in length`, + }, + }); + } } if (body.discriminator) { |