summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-01 14:20:41 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-01 14:20:41 +1100
commit1bee8dc48f0221716deba3dd7d249d7cd0cb8aea (patch)
tree426d1e108f8c59360467369ea8febe2a0e67aac3
parentDon't let users undisable their accounts (diff)
downloadserver-1bee8dc48f0221716deba3dd7d249d7cd0cb8aea.tar.xz
Revert "Don't let users undisable their accounts"
This reverts commit cd84412c92c447826ebb2668295d46956618d962.
-rw-r--r--src/api/routes/auth/login.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/api/routes/auth/login.ts b/src/api/routes/auth/login.ts
index b9cefe1a..bbfb5425 100644
--- a/src/api/routes/auth/login.ts
+++ b/src/api/routes/auth/login.ts
@@ -66,6 +66,9 @@ router.post(
 		});
 
 		if (undelete) {
+			// undelete refers to un'disable' here
+			if (user.disabled)
+				await User.update({ id: user.id }, { disabled: false });
 			if (user.deleted)
 				await User.update({ id: user.id }, { deleted: false });
 		} else {
@@ -74,14 +77,13 @@ router.post(
 					message: "This account is scheduled for deletion.",
 					code: 20011,
 				});
+			if (user.disabled)
+				return res.status(400).json({
+					message: req.t("auth:login.ACCOUNT_DISABLED"),
+					code: 20013,
+				});
 		}
 
-		if (user.disabled)
-			return res.status(400).json({
-				message: req.t("auth:login.ACCOUNT_DISABLED"),
-				code: 20013,
-			});
-
 		// the salt is saved in the password refer to bcrypt docs
 		const same_password = await bcrypt.compare(
 			password,