mirror of https://github.com/zulip/zulip.git
support: Rate limit demo form requests.
This commit is contained in:
parent
d4841bbeff
commit
7d3877f69a
|
@ -56,6 +56,7 @@ from zerver.actions.users import do_delete_user_preserving_messages
|
||||||
from zerver.decorator import require_server_admin, zulip_login_required
|
from zerver.decorator import require_server_admin, zulip_login_required
|
||||||
from zerver.forms import check_subdomain_available
|
from zerver.forms import check_subdomain_available
|
||||||
from zerver.lib.exceptions import JsonableError
|
from zerver.lib.exceptions import JsonableError
|
||||||
|
from zerver.lib.rate_limiter import rate_limit_request_by_ip
|
||||||
from zerver.lib.realm_icon import realm_icon_url
|
from zerver.lib.realm_icon import realm_icon_url
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.send_email import FromAddress, send_email
|
from zerver.lib.send_email import FromAddress, send_email
|
||||||
|
@ -167,6 +168,8 @@ def demo_request(request: HttpRequest) -> HttpResponse:
|
||||||
form = DemoRequestForm(post_data)
|
form = DemoRequestForm(post_data)
|
||||||
|
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
rate_limit_request_by_ip(request, domain="sends_email_by_ip")
|
||||||
|
|
||||||
email_context = {
|
email_context = {
|
||||||
"full_name": form.cleaned_data["full_name"],
|
"full_name": form.cleaned_data["full_name"],
|
||||||
"email": form.cleaned_data["email"],
|
"email": form.cleaned_data["email"],
|
||||||
|
|
Loading…
Reference in New Issue