Skip to content

Commit 0ffc573

Browse files
authored
Merge pull request #209 from vsevolod-kolchinsky/patch-1
allows registration throttle control
2 parents 235efa4 + ff641cf commit 0ffc573

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/configuration.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,20 @@ Configuration
4949
- **OLD_PASSWORD_FIELD_ENABLED** - set it to True if you want to have old password verification on password change enpoint (default: False)
5050

5151
- **LOGOUT_ON_PASSWORD_CHANGE** - set to False if you want to keep the current user logged in after a password change
52+
53+
54+
Throttling
55+
=============
56+
57+
You may specify custom throttling for ``rest_auth.register.views.RegisterView`` by specifying DRF settings:
58+
59+
.. code-block:: python
60+
61+
REST_FRAMEWORK = {
62+
'DEFAULT_THROTTLE_RATES': {
63+
'anon': '6/m',
64+
'register_view':'1/h',
65+
},
66+
}
67+
68+

rest_auth/registration/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class RegisterView(CreateAPIView):
2828
serializer_class = RegisterSerializer
2929
permission_classes = (AllowAny, )
3030
token_model = TokenModel
31+
throttle_scope = 'register_view'
3132

3233
def get_response_data(self, user):
3334
if allauth_settings.EMAIL_VERIFICATION == \

0 commit comments

Comments
 (0)