mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-06-14 06:40:08 +00:00
Basic ratelimit for user login (including 2FA) and admin login
This commit is contained in:
parent
0a5df06e77
commit
5529264c3f
7 changed files with 134 additions and 2 deletions
|
@ -166,6 +166,10 @@ fn post_admin_login(
|
|||
) -> Result<Redirect, Flash<Redirect>> {
|
||||
let data = data.into_inner();
|
||||
|
||||
if crate::ratelimit::check_limit_admin(&ip.ip).is_err() {
|
||||
return Err(Flash::error(Redirect::to(admin_url(referer)), "Too many requests, try again later."));
|
||||
}
|
||||
|
||||
// If the token is invalid, redirect to login page
|
||||
if !_validate_token(&data.token) {
|
||||
error!("Invalid admin token. IP: {}", ip.ip);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue