Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

exceptions: Deduplicate common authentication errors.

Tim Abbottdbf886dfceb8
diff --git a/zerver/lib/exceptions.py b/zerver/lib/exceptions.py
index 6490267a9fd..6d1e78f81df 100644
--- a/zerver/lib/exceptions.py
+++ b/zerver/lib/exceptions.py
@@ -291,48 +291,32 @@ class AuthenticationFailedError(JsonableError):
return _("Your username or password is incorrect")
-class UserDeactivatedError(JsonableError):
+class UserDeactivatedError(AuthenticationFailedError):
code: ErrorCode = ErrorCode.USER_DEACTIVATED
- http_status_code = 403
-
- def __init__(self) -> None:
- pass
@staticmethod
def msg_format() -> str:
return _("Account is deactivated")
-class RealmDeactivatedError(JsonableError):
+class RealmDeactivatedError(AuthenticationFailedError):
code: ErrorCode = ErrorCode.REALM_DEACTIVATED
- http_status_code = 403
-
- def __init__(self) -> None:
- pass
@staticmethod
def msg_format() -> str:
return _("This organization has been deactivated")
-class PasswordAuthDisabledError(JsonableError):
+class PasswordAuthDisabledError(AuthenticationFailedError):
code: ErrorCode = ErrorCode.PASSWORD_AUTH_DISABLED
- http_status_code = 403
-
- def __init__(self) -> None:
- pass
@staticmethod
def msg_format() -> str:
return _("Password authentication is disabled in this organization")
-class PasswordResetRequiredError(JsonableError):
+class PasswordResetRequiredError(AuthenticationFailedError):
code: ErrorCode = ErrorCode.PASSWORD_RESET_REQUIRED
- http_status_code = 403
-
- def __init__(self) -> None:
- pass
@staticmethod
def msg_format() -> str: