Skip to content

Commit 596cbee

Browse files
committed
add DRF throttle scopes to relevant rest auth views
1 parent 624ad01 commit 596cbee

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

rest_auth/registration/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class RegisterView(CreateAPIView):
4040
serializer_class = RegisterSerializer
4141
permission_classes = register_permission_classes()
4242
token_model = TokenModel
43+
throttle_scope = 'rest_auth'
4344

4445
@sensitive_post_parameters_m
4546
def dispatch(self, *args, **kwargs):

rest_auth/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class LoginView(GenericAPIView):
4343
permission_classes = (AllowAny,)
4444
serializer_class = LoginSerializer
4545
token_model = TokenModel
46+
throttle_scope = 'rest_auth'
4647

4748
@sensitive_post_parameters_m
4849
def dispatch(self, *args, **kwargs):
@@ -114,6 +115,7 @@ class LogoutView(APIView):
114115
Accepts/Returns nothing.
115116
"""
116117
permission_classes = (AllowAny,)
118+
throttle_scope = 'rest_auth'
117119

118120
def get(self, request, *args, **kwargs):
119121
if getattr(settings, 'ACCOUNT_LOGOUT_ON_GET', False):
@@ -178,6 +180,7 @@ class PasswordResetView(GenericAPIView):
178180
"""
179181
serializer_class = PasswordResetSerializer
180182
permission_classes = (AllowAny,)
183+
throttle_scope = 'rest_auth'
181184

182185
def post(self, request, *args, **kwargs):
183186
# Create a serializer with request.data
@@ -203,6 +206,7 @@ class PasswordResetConfirmView(GenericAPIView):
203206
"""
204207
serializer_class = PasswordResetConfirmSerializer
205208
permission_classes = (AllowAny,)
209+
throttle_scope = 'rest_auth'
206210

207211
@sensitive_post_parameters_m
208212
def dispatch(self, *args, **kwargs):
@@ -226,6 +230,7 @@ class PasswordChangeView(GenericAPIView):
226230
"""
227231
serializer_class = PasswordChangeSerializer
228232
permission_classes = (IsAuthenticated,)
233+
throttle_scope = 'rest_auth'
229234

230235
@sensitive_post_parameters_m
231236
def dispatch(self, *args, **kwargs):

0 commit comments

Comments
 (0)