summary refs log tree commit diff
path: root/synapse/util/stringutils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-03-18 11:38:52 +0000
committerErik Johnston <erik@matrix.org>2015-03-18 11:38:52 +0000
commited4d44d833f671758456be421660029aee3778cd (patch)
tree563bb423551f8c264907b06cac6053f44cbfabf6 /synapse/util/stringutils.py
parentClean out event_forward_extremities table when the server rejoins the room (diff)
parentFactor out user id validation checks (diff)
downloadsynapse-ed4d44d833f671758456be421660029aee3778cd.tar.xz
Merge pull request #109 from matrix-org/default_registration
Disable registration by default. Add script to register new users. 
Diffstat (limited to 'synapse/util/stringutils.py')
-rw-r--r--synapse/util/stringutils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/util/stringutils.py b/synapse/util/stringutils.py
index ea53a8085c..52e66beaee 100644
--- a/synapse/util/stringutils.py
+++ b/synapse/util/stringutils.py
@@ -16,6 +16,10 @@
 import random
 import string
 
+_string_with_symbols = (
+    string.digits + string.ascii_letters + ".,;:^&*-_+=#~@"
+)
+
 
 def origin_from_ucid(ucid):
     return ucid.split("@", 1)[1]
@@ -23,3 +27,9 @@ def origin_from_ucid(ucid):
 
 def random_string(length):
     return ''.join(random.choice(string.ascii_letters) for _ in xrange(length))
+
+
+def random_string_with_symbols(length):
+    return ''.join(
+        random.choice(_string_with_symbols) for _ in xrange(length)
+    )