Set the session to undefined, instead.

This commit is contained in:
zkldi
2022-01-02 19:59:48 +00:00
parent 5bf816860c
commit 11c989ca0b
2 changed files with 4 additions and 5 deletions
@@ -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,9 +61,7 @@ router.post(
),
async (req, res) => {
if (req.session.tachi?.user.id) {
// @ts-expect-error Type error with the @types/express-session library,
// i think.
req.session.destroy();
req.session.tachi = undefined;
}
logger.verbose(`Received login request with username ${req.body.username} (${req.ip})`);