mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-08 02:35:02 -04:00
Add type hints to some handlers (#8505)
This commit is contained in:
parent
a97cec18bb
commit
a93f3121f8
10 changed files with 60 additions and 22 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue