summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-08 22:47:18 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-08 22:47:18 +1000
commita9a74ae67a47c8e5791de1205e1d3d48b73855fc (patch)
tree5f94937f10ba5b0fc62992cb7694bfa67e1dfffa /api
parentOauth login now copies avatar (diff)
parentCheck if email required in PATCH @me (diff)
downloadserver-a9a74ae67a47c8e5791de1205e1d3d48b73855fc.tar.xz
Merge branch 'fix/claim_accounts' into slowcord
Diffstat (limited to 'api')
-rw-r--r--api/src/routes/users/@me/index.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts
index add9417b..6be9d3f2 100644
--- a/api/src/routes/users/@me/index.ts
+++ b/api/src/routes/users/@me/index.ts
@@ -1,5 +1,5 @@
 import { Router, Request, Response } from "express";
-import { User, PrivateUserProjection, emitEvent, UserUpdateEvent, handleFile, FieldErrors, adjustEmail } from "@fosscord/util";
+import { User, PrivateUserProjection, emitEvent, UserUpdateEvent, handleFile, FieldErrors, adjustEmail, Config } from "@fosscord/util";
 import { route } from "@fosscord/api";
 import bcrypt from "bcrypt";
 import { HTTPError } from "lambert-server";
@@ -52,10 +52,10 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
 
 	if (body.email) {
 		body.email = adjustEmail(body.email);
-		if (!body.email)
+		if (!body.email && Config.get().register.email.required)
 			throw FieldErrors({ email: { message: req.t("auth:register.EMAIL_INVALID"), code: "EMAIL_INVALID" } });
 		if (!body.password)
-			throw FieldErrors({ password: { message: req.t("auth:register.INVALID_PASSWORD"), code: "INVALID_PASSWORD" } })
+			throw FieldErrors({ password: { message: req.t("auth:register.INVALID_PASSWORD"), code: "INVALID_PASSWORD" } });
 	}
 
 	if (body.new_password) {