summary refs log tree commit diff
path: root/src/api/routes/auth
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@protonmail.com>2023-09-08 21:33:04 -0400
committerPuyodead1 <puyodead@protonmail.com>2023-12-23 16:38:15 -0500
commit4d027a424e442f10371d205e68aa3bf63d0eba0e (patch)
treecfce10a0f47f497ce89f4f18ec31cc685cb2941a /src/api/routes/auth
parentupdate user modify for unique usernames (diff)
downloadserver-ts-4d027a424e442f10371d205e68aa3bf63d0eba0e.tar.xz
Implement Pomelo Registration
Diffstat (limited to 'src/api/routes/auth')
-rw-r--r--src/api/routes/auth/register.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/api/routes/auth/register.ts b/src/api/routes/auth/register.ts

index de1cbd3d..33fc6062 100644 --- a/src/api/routes/auth/register.ts +++ b/src/api/routes/auth/register.ts
@@ -50,9 +50,18 @@ router.post( }), async (req: Request, res: Response) => { const body = req.body as RegisterSchema; - const { register, security, limits } = Config.get(); + const { register, security, limits, general } = Config.get(); const ip = getIpAdress(req); + if (!general.uniqueUsernames && body.unique_username_registration) { + throw FieldErrors({ + unique_username_registration: { + code: "UNIQUE_USERNAMES_DISABLED", + message: req.t("auth:register.UNIQUE_USERNAMES_DISABLED"), + }, + }); + } + // Reg tokens // They're a one time use token that bypasses registration limits ( rates, disabled reg, etc ) let regTokenUsed = false;