From 7e285e91fa45bfccd66edc4d3b72020c75b6fca6 Mon Sep 17 00:00:00 2001 From: Akif9748 Date: Wed, 24 Aug 2022 22:27:23 +0300 Subject: [PATCH] fix Co-authored-by: Sapphire1525 --- public/js/thread.js | 2 +- routes/register.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/public/js/thread.js b/public/js/thread.js index 8fe1484..9a2639d 100644 --- a/public/js/thread.js +++ b/public/js/thread.js @@ -66,7 +66,7 @@ function renderMessage(message) { /** * Message Sender */ - document.getElementById("send").addEventListener("submit", async e => { +document.getElementById("send").addEventListener("submit", async e => { e.preventDefault(); const form = e.target; diff --git a/routes/register.js b/routes/register.js index 1376aa5..881c6dd 100644 --- a/routes/register.js +++ b/routes/register.js @@ -6,7 +6,12 @@ const app = Router(); app.get("/", (req, res) => res.render("register")); -app.post("/", async (req, res) => { +app.post("/", rateLimit({ + windowMs: 24*60*60_000, max: 1, standardHeaders: true, legacyHeaders: false, + handler: (request, response, next, options) => + response.error(options.statusCode, "You are begin ratelimited") + +}), async (req, res) => { req.session.userid = null;