Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
TPA
Anonymous Ticket Portal
Commits
f0bb4789
Commit
f0bb4789
authored
Feb 11, 2021
by
ViolanteCodes
Browse files
attempted to create rate_limit decorator by post
parent
27be70f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
anonticket/views.py
View file @
f0bb4789
...
@@ -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'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment