summary refs log tree commit diff
path: root/synapse/api/errors.py
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-07-15 11:45:29 +0100
committerGitHub <noreply@github.com>2019-07-15 11:45:29 +0100
commit18c516698e78004df39ec62c3fc08ff03313ba4e (patch)
treef77ee0a55dae567f16ebcadc8c33428381c35607 /synapse/api/errors.py
parentMerge pull request #5589 from matrix-org/erikj/admin_exfiltrate_data (diff)
downloadsynapse-18c516698e78004df39ec62c3fc08ff03313ba4e.tar.xz
Return a different error from Invalid Password when a user is deactivated (#5674)
Return `This account has been deactivated` instead of `Invalid password` when a user is deactivated.
Diffstat (limited to 'synapse/api/errors.py')
-rw-r--r--synapse/api/errors.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index a6e753c30c..ad3e262041 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -139,6 +139,22 @@ class ConsentNotGivenError(SynapseError):
         return cs_error(self.msg, self.errcode, consent_uri=self._consent_uri)
 
 
+class UserDeactivatedError(SynapseError):
+    """The error returned to the client when the user attempted to access an
+    authenticated endpoint, but the account has been deactivated.
+    """
+
+    def __init__(self, msg):
+        """Constructs a UserDeactivatedError
+
+        Args:
+            msg (str): The human-readable error message
+        """
+        super(UserDeactivatedError, self).__init__(
+            code=http_client.FORBIDDEN, msg=msg, errcode=Codes.UNKNOWN
+        )
+
+
 class RegistrationError(SynapseError):
     """An error raised when a registration event fails."""