You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from djoser.views import UserViewSet as DjoserUserViewSet
from rest_framework.decorators import action
from rest_framework.throttling import ScopedRateThrottle
class UserViewSet(DjoserUserViewSet):
# required as there's no way to set a throttle scope for actions
def get_throttles(self):
if self.action in ["reset_password"]:
self.throttle_scope = "reset_password"
return super().get_throttles()
@action(
["post"],
detail=False,
throttle_classes=[ScopedRateThrottle],
)
def reset_password(self, request, *args, **kwargs):
return super().reset_password(request, *args, **kwargs)
Thank you for the great application.
While testing the
reset_password
endpoint, I found due to lack of rate limiting it can be misused to DOS an email bomb a genuine User.Anyway, we can mitigate this?
Thanks
The text was updated successfully, but these errors were encountered: