Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Change account_threepid_delegate to a dictionary #5969

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changelog.d/5876.misc → changelog.d/5876.feature
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Replace `trust_identity_server_for_password_resets` config option with `account_threepid_delegate`.
Replace `trust_identity_server_for_password_resets` config option with `account_threepid_delegates`.
1 change: 1 addition & 0 deletions changelog.d/5969.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace `trust_identity_server_for_password_resets` config option with `account_threepid_delegates`.
1 change: 0 additions & 1 deletion changelog.d/5969.misc

This file was deleted.

18 changes: 9 additions & 9 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -907,26 +907,26 @@ uploads_path: "DATADIR/uploads"
# *trusted* identity servers. Note that this allows the configured identity server to
# reset passwords for accounts!
#
# Also be aware that if email is not set to a domain, and SMTP options have not been
# configured in the email config block, registration and resetting user passwords via
# Be aware that if `email` is not set, and SMTP options have not been
# configured in the email config block, registration and user password resets via
# email will be globally disabled.
#
# Additionally, if msisdn is not set to a domain, registration and password resets via
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved
# msisdn will be disabled regardless. This is due to Synapse currently not supporting
# any method of sending SMS messages on its own.
#
# To enable using an identity server for operations regarding a particular third-party
# identifier type, set the value to the reachable domain name of that identity server,
# including protocol definition, e.g:
# email: "https://matrix.org" # Let matrix.org handle sending emails for my users
# msisdn: "http://localhost:8090" # Delegate contacting SMS numbers to this process
# identifier type, set the value to the URL of that identity server, e.g:
# email: https://matrix.org # Let matrix.org handle sending emails for my users
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved
# msisdn: http://localhost:8090 # Delegate contacting SMS numbers to this process
#
# Servers handling the above requests must answer the .../requestToken endpoints
# defined by the Matrix Identity Service API specification:
# https://matrix.org/docs/spec/identity_service/latest
#account_threepid_delegates:
# email: ""
# msisdn: ""
#
account_threepid_delegates:
#email: https://example.com
#msisdn: http://localhost:8090

# Users who register on this homeserver will automatically be joined
# to these rooms
Expand Down
2 changes: 1 addition & 1 deletion synapse/config/emailconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def read_config(self, config, **kwargs):
):
# Use the first entry in self.trusted_third_party_id_servers instead
if self.trusted_third_party_id_servers:
# XXX: It's a little confusing that account_threepid_delegates is modified
# XXX: It's a little confusing that account_threepid_delegate_email is modified
# both in RegistrationConfig and here. We should factor this bit out
self.account_threepid_delegate_email = self.trusted_third_party_id_servers[
0
Expand Down
29 changes: 10 additions & 19 deletions synapse/config/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,9 @@ def read_config(self, config, **kwargs):
self.trusted_third_party_id_servers = config.get(
"trusted_third_party_id_servers", ["matrix.org", "vector.im"]
)
account_threepid_delegates = config.get(
"account_threepid_delegates", {"email": "", "msisdn": ""}
)
account_threepid_delegates = config.get("account_threepid_delegates") or {}
self.account_threepid_delegate_email = account_threepid_delegates.get("email")
self.account_threepid_delegate_msisdn = account_threepid_delegates.get("msisdn")
if (
self.account_threepid_delegate_email is None
or self.account_threepid_delegate_msisdn is None
):
raise ConfigError(
"account_threepid_delegates must contain fields: email, msisdn"
)

self.default_identity_server = config.get("default_identity_server")
self.allow_guest_access = config.get("allow_guest_access", False)
Expand Down Expand Up @@ -286,26 +277,26 @@ def generate_config_section(self, generate_secrets=False, **kwargs):
# *trusted* identity servers. Note that this allows the configured identity server to
# reset passwords for accounts!
#
# Also be aware that if email is not set to a domain, and SMTP options have not been
# configured in the email config block, registration and resetting user passwords via
# Be aware that if `email` is not set, and SMTP options have not been
# configured in the email config block, registration and user password resets via
# email will be globally disabled.
#
# Additionally, if msisdn is not set to a domain, registration and password resets via
# msisdn will be disabled regardless. This is due to Synapse currently not supporting
# any method of sending SMS messages on its own.
#
# To enable using an identity server for operations regarding a particular third-party
# identifier type, set the value to the reachable domain name of that identity server,
# including protocol definition, e.g:
# email: "https://matrix.org" # Let matrix.org handle sending emails for my users
# msisdn: "http://localhost:8090" # Delegate contacting SMS numbers to this process
# identifier type, set the value to the URL of that identity server, e.g:
# email: https://matrix.org # Let matrix.org handle sending emails for my users
# msisdn: http://localhost:8090 # Delegate contacting SMS numbers to this process
#
# Servers handling the above requests must answer the .../requestToken endpoints
# defined by the Matrix Identity Service API specification:
# https://matrix.org/docs/spec/identity_service/latest
#account_threepid_delegates:
# email: ""
# msisdn: ""
#
account_threepid_delegates:
#email: https://example.com
#msisdn: http://localhost:8090

# Users who register on this homeserver will automatically be joined
# to these rooms
Expand Down
4 changes: 3 additions & 1 deletion synapse/rest/client/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def on_GET(self, request):
# also requires `id_server`. If the homeserver is handling 3PID
# verification itself, there is no need to ask the user for `id_server` to
# be supplied.
"m.require_identity_server": False,
"m.require_identity_server": (
self.config.account_threepid_delegate is None
),
},
},
)
Expand Down