summary refs log tree commit diff
path: root/api/src/routes/users/@me/index.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-02-17 18:57:04 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-02-17 18:57:04 +1100
commit34f84fc0eaae026b9b29b6423802bf4ccf8248d0 (patch)
treee016b3663da320ce1f5e537fa4ae1fc10e31a02e /api/src/routes/users/@me/index.ts
parentDiscord.js gateway connection when connecting to voice will close 4002 decode... (diff)
parentMerge pull request #608 from Featyre/master (diff)
downloadserver-ts-34f84fc0eaae026b9b29b6423802bf4ccf8248d0.tar.xz
Merge branch 'master' into maddyrtc
Diffstat (limited to 'api/src/routes/users/@me/index.ts')
-rw-r--r--api/src/routes/users/@me/index.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts

index 1959704a..acca8910 100644 --- a/api/src/routes/users/@me/index.ts +++ b/api/src/routes/users/@me/index.ts
@@ -57,6 +57,13 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: user.data.hash = await bcrypt.hash(body.new_password, 12); } + var check_username = body?.username?.replace(/\s/g, ''); + if(!check_username) { + throw FieldErrors({ + username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") } + }); + } + await user.save(); // @ts-ignore