Merge pull request #618 from TNG-dev/hotfix/v2.0.28

This commit is contained in:
zkldi
2022-01-02 22:19:50 +00:00
committed by GitHub
4 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tachi-server",
"version": "2.0.27",
"version": "2.0.28",
"description": "A score tracking server.",
"main": "js/index.js",
"private": true,
+1 -1
View File
@@ -4,7 +4,7 @@
const MAJOR = 2;
const MINOR = 0;
const PATCH = 27;
const PATCH = 28;
// As is with all front-facing zkldi projects, the version names for tachi-server
// are from an album I like. In this case, the album is Portishead - Dummy.
@@ -33,7 +33,7 @@ t.test("POST /api/v1/auth/login", (t) => {
t.end();
});
t.test("Should return 409 if user already logged in", async (t) => {
t.test("Should return 200 if user already logged in", async (t) => {
const res = await mockApi.post("/api/v1/auth/login").send({
username: "test_zkldi",
"!password": "password",
@@ -51,7 +51,8 @@ t.test("POST /api/v1/auth/login", (t) => {
})
.set("Cookie", cookie);
t.equal(res2.status, 409);
// even if they have a login already going, just let them log in.
t.equal(res2.status, 200);
t.end();
});
@@ -61,14 +61,10 @@ router.post(
),
async (req, res) => {
if (req.session.tachi?.user.id) {
logger.info(`Dual log-in attempted from ${req.session.tachi.user.id}`);
return res.status(409).json({
success: false,
description: `You are already logged in as someone.`,
});
req.session.tachi = undefined;
}
logger.verbose(`received login request with username ${req.body.username} (${req.ip})`);
logger.verbose(`Received login request with username ${req.body.username} (${req.ip})`);
/* istanbul ignore next */
if (Environment.nodeEnv === "production" || Environment.nodeEnv === "staging") {
@@ -85,7 +81,7 @@ router.post(
logger.verbose("Captcha validated!");
} else {
logger.verbose("Skipped captcha check because not in production.");
logger.warn("Skipped captcha check because not in production.");
}
const requestedUser = await GetUserCaseInsensitive(req.body.username);