summary refs log tree commit diff
path: root/synapse/config
diff options
context:
space:
mode:
authorBrendan Abolivier <contact@brendanabolivier.com>2019-04-09 17:02:41 +0100
committerGitHub <noreply@github.com>2019-04-09 17:02:41 +0100
commitbfc8fdf1fcd03808b54282a856bc33a856cc5add (patch)
tree7b31c6b90103e41c1d12500eb04a98e100a10f46 /synapse/config
parentMerge pull request #5030 from matrix-org/rav/rewrite_g_s_v_k (diff)
parentAdd account expiration feature (diff)
downloadsynapse-bfc8fdf1fcd03808b54282a856bc33a856cc5add.tar.xz
Merge pull request #5027 from matrix-org/babolivier/account_expiration
Add time-based account expiration
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/registration.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/synapse/config/registration.py b/synapse/config/registration.py
index fcfda341e9..dd242b1211 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.enable_3pid_lookup = config.get("enable_3pid_lookup", True)
@@ -76,6 +87,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: