summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@riseup.net>2015-09-28 18:49:23 -0300
committerBruno Wagner <bwagner@riseup.net>2015-09-28 18:49:23 -0300
commit7b77e3f3757bbc3a7358da83e9889ce9551a4e8f (patch)
tree95a6536e4eabbfaf3c25d0f08f0b04fb8d2cc209 /service
parentea8460eeada01ccbdffe4c1198d3324469399220 (diff)
Leap web requires 8 length password, so we'll do it on UA too
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/register.py2
-rw-r--r--service/test/unit/config/test_register.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/service/pixelated/register.py b/service/pixelated/register.py
index 2a87fa36..b8e6e4fc 100644
--- a/service/pixelated/register.py
+++ b/service/pixelated/register.py
@@ -62,7 +62,7 @@ def register(
def validate_username(username):
accepted_characters = '^[a-z0-9\-\_\.]*$'
- if not re.match(accepted_characters, username):
+ if not re.match(accepted_characters, username) or len(username) > 8:
raise ValueError
diff --git a/service/test/unit/config/test_register.py b/service/test/unit/config/test_register.py
index 8e1a71a4..b127ab86 100644
--- a/service/test/unit/config/test_register.py
+++ b/service/test/unit/config/test_register.py
@@ -13,6 +13,10 @@ class TestRegister(unittest.TestCase):
with self.assertRaises(ValueError):
validate_username('invalid@username')
+ def test_username_at_least_8_characters(self):
+ with self.assertRaises(ValueError):
+ validate_username('short')
+
def test_username_pass_when_valid(self):
try:
validate_username('a.valid_username-123')