#506 Add warning on wrong password attemps

This commit is contained in:
Thomas Camlong
2022-11-15 00:14:17 +09:00
parent a50c43cab0
commit 5f61940c92

View File

@@ -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,
});