diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2019-04-08 17:10:55 +0100 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2019-04-09 16:46:04 +0100 |
commit | 747aa9f8cad92ffcda51b2aa07987c87f4353649 (patch) | |
tree | ae8f2fb18b70f968534e94d6bbdaa132e0211736 /synapse/config/registration.py | |
parent | 0.99.3 (diff) | |
download | synapse-747aa9f8cad92ffcda51b2aa07987c87f4353649.tar.xz |
Add account expiration feature
Diffstat (limited to 'synapse/config/registration.py')
-rw-r--r-- | synapse/config/registration.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/config/registration.py b/synapse/config/registration.py index f6b2b9ceee..b7a7b4f1cf 100644 --- a/synapse/config/registration.py +++ b/synapse/config/registration.py @@ -20,6 +20,15 @@ from synapse.types import RoomAlias from synapse.util.stringutils import random_string_with_symbols +class AccountValidityConfig(Config): + def __init__(self, config): + self.enabled = (len(config) > 0) + + period = config.get("period", None) + if period: + self.period = self.parse_duration(period) + + class RegistrationConfig(Config): def read_config(self, config): @@ -31,6 +40,8 @@ class RegistrationConfig(Config): strtobool(str(config["disable_registration"])) ) + self.account_validity = AccountValidityConfig(config.get("account_validity", {})) + self.registrations_require_3pid = config.get("registrations_require_3pid", []) self.allowed_local_3pids = config.get("allowed_local_3pids", []) self.registration_shared_secret = config.get("registration_shared_secret") @@ -75,6 +86,12 @@ class RegistrationConfig(Config): # #enable_registration: false + # Optional account validity parameter. This allows for, e.g., accounts to + # be denied any request after a given period. + # + #account_validity: + # period: 6w + # The user must provide all of the below types of 3PID when registering. # #registrations_require_3pid: |