From 5f61940c92a923b0d9cf89c798fd4a656fdb5553 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Tue, 15 Nov 2022 00:14:17 +0900 Subject: [PATCH 1/2] #506 Add warning on wrong password attemps --- src/pages/api/configs/tryPassword.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/api/configs/tryPassword.tsx b/src/pages/api/configs/tryPassword.tsx index 8f3848b9d..fee00cb00 100644 --- a/src/pages/api/configs/tryPassword.tsx +++ b/src/pages/api/configs/tryPassword.tsx @@ -1,3 +1,4 @@ +import Consola from 'consola'; import { NextApiRequest, NextApiResponse } from 'next'; function Post(req: NextApiRequest, res: NextApiResponse) { @@ -8,6 +9,12 @@ function Post(req: NextApiRequest, res: NextApiResponse) { success: true, }); } + // Warn that there was a wrong password attempt (date : wrong password, password tried, person's IP) + Consola.warn( + `${new Date().toLocaleString()} : Wrong password attempt, tried ${tried}, from ${ + req.headers['x-forwarded-for'] + }` + ); return res.status(200).json({ success: false, }); From d9ee11af79098c59099c70d0e661a4dea9a73d08 Mon Sep 17 00:00:00 2001 From: Thomas Camlong <49837342+ajnart@users.noreply.github.com> Date: Thu, 17 Nov 2022 20:16:43 +0900 Subject: [PATCH 2/2] Update tryPassword.tsx --- src/pages/api/configs/tryPassword.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/api/configs/tryPassword.tsx b/src/pages/api/configs/tryPassword.tsx index fee00cb00..381845abf 100644 --- a/src/pages/api/configs/tryPassword.tsx +++ b/src/pages/api/configs/tryPassword.tsx @@ -9,9 +9,9 @@ function Post(req: NextApiRequest, res: NextApiResponse) { success: true, }); } - // Warn that there was a wrong password attempt (date : wrong password, password tried, person's IP) + // Warn that there was a wrong password attempt (date : wrong password, person's IP) Consola.warn( - `${new Date().toLocaleString()} : Wrong password attempt, tried ${tried}, from ${ + `${new Date().toLocaleString()} : Wrong password attempt, from ${ req.headers['x-forwarded-for'] }` );