Commit f0bb4789 authored by ViolanteCodes's avatar ViolanteCodes
Browse files

attempted to create rate_limit decorator by post

parent 27be70f4
...@@ -692,10 +692,30 @@ def issue_search_view(request, user_identifier): ...@@ -692,10 +692,30 @@ def issue_search_view(request, user_identifier):
# Views related to creating/looking up notes. # Views related to creating/looking up notes.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@method_decorator(ratelimit(key='ip', rate='0/m', method=ratelimit.UNSAFE, block=True), name='post',)
@method_decorator(validate_user, name='dispatch') @method_decorator(validate_user, name='dispatch')
class NoteCreateView(PassUserIdentifierMixin, CreateView): class NoteCreateView(PassUserIdentifierMixin, CreateView):
"""View to create a note given a user_identifier.""" """View to create a note given a user_identifier."""
# @method_decorator(
# ratelimit(
# group=RATE_GROUP
# key='ip',
# rate=get_rate_limit(group, request),
# method=ratelimit.UNSAFE,
# block=True
# ),
# name='post',
# )
@method_decorator(
ratelimit(
group=RATE_GROUP
key='post:',
rate=get_rate_limit(group, request),
method=ratelimit.UNSAFE,
block=True
),
name='post',
)
model=Note model=Note
fields = ['body'] fields = ['body']
template_name_suffix = '_create_form' template_name_suffix = '_create_form'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment