Browse Source

Fix regex and temporarily add : character

Andrew Morgan 4 years ago
parent
commit
2982bd639c
1 changed files with 5 additions and 2 deletions
  1. 5 2
      sydent/util/stringutils.py

+ 5 - 2
sydent/util/stringutils.py

@@ -14,7 +14,10 @@
 # limitations under the License.
 import re
 
-client_secret_regex = re.compile(r"^[0-9a-zA-Z.=_-]+$")
+# https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register-email-requesttoken
+# Note: The : character is allowed here for older clients, but will be removed in a
+# future release. Context: https://github.com/matrix-org/sydent/issues/247
+client_secret_regex = re.compile(r"^[0-9a-zA-Z\.\=\_\-\:]+$")
 
 
 def is_valid_client_secret(client_secret):
@@ -24,4 +27,4 @@ def is_valid_client_secret(client_secret):
     :returns: Whether the client_secret is valid
     :rtype: bool
     """
-    return client_secret_regex.match(client_secret) is not None
+    return client_secret_regex.match(client_secret) is not None