mirror of
https://github.com/zulip/zulip.git
synced 2025-10-31 20:13:46 +00:00
exceptions: Make RateLimited into a subclass of JsonableError.
This simplifies the code, as it allows using the mechanism of converting JsonableErrors into a response instead of having separate, but ultimately similar, logic in RateLimitMiddleware. We don't touch tests here because "rate limited" error responses are already verified in test_external.py.
This commit is contained in:
committed by
Alex Vandiver
parent
92ce2d0e31
commit
43a0c60e96
@@ -349,7 +349,8 @@ class OurAuthenticationForm(AuthenticationForm):
|
||||
self.user_cache = authenticate(request=self.request, username=username, password=password,
|
||||
realm=realm, return_data=return_data)
|
||||
except RateLimited as e:
|
||||
secs_to_freedom = int(float(str(e)))
|
||||
assert e.secs_to_freedom is not None
|
||||
secs_to_freedom = int(e.secs_to_freedom)
|
||||
raise ValidationError(AUTHENTICATION_RATE_LIMITED_ERROR.format(secs_to_freedom))
|
||||
|
||||
if return_data.get("inactive_realm"):
|
||||
|
||||
Reference in New Issue
Block a user