summary refs log tree commit diff
path: root/synapse/rest/client/register.py
diff options
context:
space:
mode:
authorWill Hunt <will@half-shot.uk>2022-04-27 13:57:53 +0100
committerGitHub <noreply@github.com>2022-04-27 12:57:53 +0000
commite8d1ec0e92da96a01b6c723fcdb4eac27f801e87 (patch)
treea751bfd0999028ee404e1a373fa376c7762bfa15 /synapse/rest/client/register.py
parentAdd some type hints to datastore (#12485) (diff)
downloadsynapse-e8d1ec0e92da96a01b6c723fcdb4eac27f801e87.tar.xz
Add option to enable token registration without requiring 3pids (#12526)
Diffstat (limited to 'synapse/rest/client/register.py')
-rw-r--r--synapse/rest/client/register.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/rest/client/register.py b/synapse/rest/client/register.py
index 70baf50fa4..13ef6b35a0 100644
--- a/synapse/rest/client/register.py
+++ b/synapse/rest/client/register.py
@@ -929,6 +929,10 @@ def _calculate_registration_flows(
         # always let users provide both MSISDN & email
         flows.append([LoginType.MSISDN, LoginType.EMAIL_IDENTITY])
 
+    # Add a flow that doesn't require any 3pids, if the config requests it.
+    if config.registration.enable_registration_token_3pid_bypasss:
+        flows.append([LoginType.REGISTRATION_TOKEN])
+
     # Prepend m.login.terms to all flows if we're requiring consent
     if config.consent.user_consent_at_registration:
         for flow in flows:
@@ -942,7 +946,8 @@ def _calculate_registration_flows(
     # Prepend registration token to all flows if we're requiring a token
     if config.registration.registration_requires_token:
         for flow in flows:
-            flow.insert(0, LoginType.REGISTRATION_TOKEN)
+            if LoginType.REGISTRATION_TOKEN not in flow:
+                flow.insert(0, LoginType.REGISTRATION_TOKEN)
 
     return flows