Added throttling to v2 api routes

This commit is contained in:
Spitap
2023-01-27 16:27:52 +01:00
parent 955b5016fb
commit 0d2f3d05a3
9 changed files with 61 additions and 8 deletions
+6 -2
View File
@@ -188,11 +188,15 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
REST_FRAMEWORK = {
'DEFAULT_THROTTLE_CLASSES': [
'rest_framework.throttling.AnonRateThrottle',
'rest_framework.throttling.ScopedRateThrottle'
'rest_framework.throttling.ScopedRateThrottle',
'modoboa.lib.throttle.UserDosThrottle',
'modoboa.lib.throttle.AnonDosThrottle'
],
'DEFAULT_THROTTLE_RATES': {
'anon': '100/hour',
'login': '5/hour',
'login': '3/minute',
'ddos': '100/minute',
'anon_ddos': '10/minute',
'password_recovery_request': '6/hour',
'password_recovery_totp_check': '20/hour',
'password_recovery_apply': '20/hour'