aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-10-01 18:33:58 +0200
committerMarvin Borner2020-10-01 18:33:58 +0200
commitae9721b603202741afeca180f61e74da6061eee0 (patch)
treeec844a55ea35d12fc1acd8c8086e77129ddf0de7
parent83007e8e3b13ee1eb0670ebd04f4530394cbffc9 (diff)
Interesting ig
-rw-r--r--auth/index.js4
-rw-r--r--motto/index.js3
2 files changed, 3 insertions, 4 deletions
diff --git a/auth/index.js b/auth/index.js
index 69f6435..0dac61c 100644
--- a/auth/index.js
+++ b/auth/index.js
@@ -12,14 +12,14 @@ app.use("/", express.static(__dirname + "/public"));
app.post("/api/login", async (req, res) => {
const { username, password } = req.body;
if (!(username && password)) return res.send("error");
- const user = await db.query("SELECT id, password FROM users WHERE username = ?", [username]);
+ const user = (await db.query("SELECT id, password FROM users WHERE username = ?", [username]))[0];
if (!user.password) return res.send("error");
const loggedIn = await bcrypt.compare(password, user.password);
if (loggedIn) {
req.session.loggedIn = true;
req.session.uid = user.id;
}
- return res.send(LoggedIn);
+ return res.send(loggedIn);
});
app.put("/api/password", async (req, res) => {
diff --git a/motto/index.js b/motto/index.js
index 77365a8..4a8ed3b 100644
--- a/motto/index.js
+++ b/motto/index.js
@@ -3,14 +3,13 @@ const rateLimit = require("express-rate-limit");
const db = require("../db");
const app = express.Router();
-const fs = require("fs");
-
const apiLimiter = rateLimit({
windowMs: 10 * 60 * 1000,
max: 100,
message: "Access overflow!",
});
+//const fs = require("fs");
//app.get("/sync", (req, res) => {
// fs.readFile(__dirname + "/list.txt", "utf8", (err, data) => {
// if (err) {