Increase limit for the dashboard and do it by user

This commit is contained in:
Adrià Casajús 2023-12-19 17:27:55 +01:00
parent dc39ab2de7
commit 2a9c1c5658
No known key found for this signature in database
GPG key ID: F0033226A5AFC9B9
2 changed files with 3 additions and 7 deletions

View file

@ -31,6 +31,7 @@ from app.models import Alias, Contact, Mailbox, AliasMailbox
@deprecated
@api_bp.route("/aliases", methods=["GET", "POST"])
@require_api_auth
@limiter.limit("10/minute", key_func=lambda: g.user.id)
def get_aliases():
"""
Get aliases
@ -72,10 +73,8 @@ def get_aliases():
@api_bp.route("/v2/aliases", methods=["GET", "POST"])
@limiter.limit(
"5/minute",
)
@require_api_auth
@limiter.limit("10/minute", key_func=lambda: g.user.id)
def get_aliases_v2():
"""
Get aliases

View file

@ -57,10 +57,7 @@ def get_stats(user: User) -> Stats:
methods=["POST"],
exempt_when=lambda: request.form.get("form-name") != "create-random-email",
)
@limiter.limit(
"5/minute",
methods=["GET"],
)
@limiter.limit("10/minute", methods=["GET"], key_func=lambda: current_user.id)
@login_required
@parallel_limiter.lock(
name="alias_creation",