summary refs log tree commit diff
path: root/synapse/handlers/password_policy.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-10-09 07:20:51 -0400
committerGitHub <noreply@github.com>2020-10-09 07:20:51 -0400
commita93f3121f8fd1c2b77e003d8e43ce881635bb098 (patch)
tree2abb73eb4b3fe2334ab5b2c162c1224189740959 /synapse/handlers/password_policy.py
parentInvalidate the cache when an olm fallback key is uploaded (#8501) (diff)
downloadsynapse-a93f3121f8fd1c2b77e003d8e43ce881635bb098.tar.xz
Add type hints to some handlers (#8505)
Diffstat (limited to 'synapse/handlers/password_policy.py')
-rw-r--r--synapse/handlers/password_policy.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/handlers/password_policy.py b/synapse/handlers/password_policy.py
index 88e2f87200..6c635cc31b 100644
--- a/synapse/handlers/password_policy.py
+++ b/synapse/handlers/password_policy.py
@@ -16,14 +16,18 @@
 
 import logging
 import re
+from typing import TYPE_CHECKING
 
 from synapse.api.errors import Codes, PasswordRefusedError
 
+if TYPE_CHECKING:
+    from synapse.app.homeserver import HomeServer
+
 logger = logging.getLogger(__name__)
 
 
 class PasswordPolicyHandler:
-    def __init__(self, hs):
+    def __init__(self, hs: "HomeServer"):
         self.policy = hs.config.password_policy
         self.enabled = hs.config.password_policy_enabled
 
@@ -33,11 +37,11 @@ class PasswordPolicyHandler:
         self.regexp_uppercase = re.compile("[A-Z]")
         self.regexp_lowercase = re.compile("[a-z]")
 
-    def validate_password(self, password):
+    def validate_password(self, password: str) -> None:
         """Checks whether a given password complies with the server's policy.
 
         Args:
-            password (str): The password to check against the server's policy.
+            password: The password to check against the server's policy.
 
         Raises:
             PasswordRefusedError: The password doesn't comply with the server's policy.