8000 fix: make rate_limiter respect multitenancy (backport #24634) by mergify[bot] · Pull Request #24635 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: make rate_limiter respect multitenancy (backport #24634) #24635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frappe/core/doctype/user/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ def sign_up(email, full_name, redirect_to):


@frappe.whitelist(allow_guest=True)
@rate_limit(limit=get_password_reset_limit, seconds=24 * 60 * 60)
@rate_limit(limit=get_password_reset_limit, seconds=60 * 60)
def reset_password(user):
if user == "Administrator":
return "not allowed"
Expand Down
2 changes: 1 addition & 1 deletion frappe/rate_limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def wrapper(*args, **kwargs):
if not identity:
frappe.throw(_("Either key or IP flag is required."))

cache_key = f"rl:{frappe.form_dict.cmd}:{identity}"
cache_key = frappe.cache().make_key(f"rl:{frappe.form_dict.cmd}:{identity}")

value = frappe.cache().get(cache_key) or 0
if not value:
Expand Down
2 changes: 1 addition & 1 deletion frappe/utils/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,4 @@ def get_encryption_key():


def get_password_reset_limit():
return frappe.db.get_single_value("System Settings", "password_reset_limit") or 0
return frappe.get_system_settings("password_reset_limit") or 3
0