diff options
author | Matthew Hodgson <matthew@arasphere.net> | 2018-05-03 18:19:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-03 18:19:58 +0100 |
commit | f639ac143d146e02b1fdd3f7b4e00017a1b79f53 (patch) | |
tree | 0a7d78db15aef90439324dc953ccdffee8c25419 | |
parent | Merge pull request #3179 from matrix-org/matthew/disable-set-profile (diff) | |
parent | fix defaults in config example (diff) | |
download | synapse-f639ac143d146e02b1fdd3f7b4e00017a1b79f53.tar.xz |
Merge pull request #3180 from matrix-org/matthew/disable-3pid-changes
add option to disable changes to the 3PIDs for an account.
-rw-r--r-- | synapse/config/registration.py | 8 | ||||
-rw-r--r-- | synapse/rest/client/v2_alpha/account.py | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/synapse/config/registration.py b/synapse/config/registration.py index 4a4de661e7..8aa3bcb009 100644 --- a/synapse/config/registration.py +++ b/synapse/config/registration.py @@ -37,6 +37,9 @@ class RegistrationConfig(Config): "check_is_for_allowed_local_3pids", None ) self.allow_invited_3pids = config.get("allow_invited_3pids", False) + + self.disable_3pid_changes = config.get("disable_3pid_changes", False) + self.registration_shared_secret = config.get("registration_shared_secret") self.bcrypt_rounds = config.get("bcrypt_rounds", 12) @@ -92,6 +95,11 @@ class RegistrationConfig(Config): # - medium: msisdn # pattern: "\\+44" + # If true, stop users from trying to change the 3PIDs associated with + # their accounts. + # + # disable_3pid_changes: False + # If set, allows registration by anyone who also has the shared # secret, even if registration is otherwise disabled. registration_shared_secret: "%(registration_shared_secret)s" diff --git a/synapse/rest/client/v2_alpha/account.py b/synapse/rest/client/v2_alpha/account.py index 7d43a33615..3738ad437e 100644 --- a/synapse/rest/client/v2_alpha/account.py +++ b/synapse/rest/client/v2_alpha/account.py @@ -314,6 +314,9 @@ class ThreepidRestServlet(RestServlet): def on_POST(self, request): yield run_on_reactor() + if self.hs.config.disable_3pid_changes: + raise SynapseError(400, "3PID changes disabled on this server") + body = parse_json_object_from_request(request) threePidCreds = body.get('threePidCreds') @@ -367,6 +370,9 @@ class ThreepidDeleteRestServlet(RestServlet): def on_POST(self, request): yield run_on_reactor() + if self.hs.config.disable_3pid_changes: + raise SynapseError(400, "3PID changes disabled on this server") + body = parse_json_object_from_request(request) required = ['medium', 'address'] |