Skip to content

Commit

Permalink
Merge pull request #209 from vsevolod-kolchinsky/patch-1
Browse files Browse the repository at this point in the history
allows registration throttle control
  • Loading branch information
mariodev committed Jul 18, 2016
2 parents 235efa4 + ff641cf commit 0ffc573
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/configuration.rst
Expand Up @@ -49,3 +49,20 @@ Configuration
- **OLD_PASSWORD_FIELD_ENABLED** - set it to True if you want to have old password verification on password change enpoint (default: False)

- **LOGOUT_ON_PASSWORD_CHANGE** - set to False if you want to keep the current user logged in after a password change


Throttling
=============

You may specify custom throttling for ``rest_auth.register.views.RegisterView`` by specifying DRF settings:

.. code-block:: python
REST_FRAMEWORK = {
'DEFAULT_THROTTLE_RATES': {
'anon': '6/m',
'register_view':'1/h',
},
}
1 change: 1 addition & 0 deletions rest_auth/registration/views.py
Expand Up @@ -28,6 +28,7 @@ class RegisterView(CreateAPIView):
serializer_class = RegisterSerializer
permission_classes = (AllowAny, )
token_model = TokenModel
throttle_scope = 'register_view'

def get_response_data(self, user):
if allauth_settings.EMAIL_VERIFICATION == \
Expand Down

0 comments on commit 0ffc573

Please sign in to comment.