mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-03 20:14:21 -04:00
add login rate limiter
This commit is contained in:
parent
8a481a1be0
commit
b77b33e790
3 changed files with 66 additions and 11 deletions
|
@ -52,6 +52,7 @@ const Database = require("./database");
|
|||
|
||||
debug("Importing Background Jobs");
|
||||
const { initBackgroundJobs } = require("./jobs");
|
||||
const { loginRateLimiter } = require("./rate-limiter");
|
||||
|
||||
const { basicAuth } = require("./auth");
|
||||
const { login } = require("./auth");
|
||||
|
@ -281,6 +282,11 @@ exports.entryPage = "dashboard";
|
|||
socket.on("login", async (data, callback) => {
|
||||
console.log("Login");
|
||||
|
||||
// Login Rate Limit
|
||||
if (! await loginRateLimiter.pass(callback)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let user = await login(data.username, data.password);
|
||||
|
||||
if (user) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue