mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 09:06:40 +03:00
Merge pull request #209 from vsevolod-kolchinsky/patch-1
allows registration throttle control
This commit is contained in:
commit
0ffc573482
|
@ -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)
|
- **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
|
- **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',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ class RegisterView(CreateAPIView):
|
||||||
serializer_class = RegisterSerializer
|
serializer_class = RegisterSerializer
|
||||||
permission_classes = (AllowAny, )
|
permission_classes = (AllowAny, )
|
||||||
token_model = TokenModel
|
token_model = TokenModel
|
||||||
|
throttle_scope = 'register_view'
|
||||||
|
|
||||||
def get_response_data(self, user):
|
def get_response_data(self, user):
|
||||||
if allauth_settings.EMAIL_VERIFICATION == \
|
if allauth_settings.EMAIL_VERIFICATION == \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user