Skip to content

Commit 44ad085

Browse files
committed
Allow spaces in usernames
1 parent 5b9bd4c commit 44ad085

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

genesis_core/tests/unit/user_api/iam/dm/test_types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ def test_instance(self):
4646
("أحمد_2023", True),
4747
("", False),
4848
(" space ", False),
49-
("two words", False),
49+
("two words", True), # " " space is allowed
5050
("emoji😊", False),
51-
("percent%age", True), # % разрешен!
52-
("invalid/", True), # / разрешен!
51+
("percent%age", True), # "%" is allowed
52+
("invalid/", True), # "/" is allowed
5353
("semicolon;test", False),
5454
('quote"mark', False),
5555
("bracket(test)", False),
5656
("angle<tag", False),
5757
("comma,separated", False),
58-
("dash-", True), # Дефис в конце разрешен
58+
("dash-", True), # trailing "-" dash is allowed
5959
("a\nb", False),
6060
],
6161
)

genesis_core/user_api/iam/dm/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Username(types.BaseCompiledRegExpType):
2323

2424
def __init__(self, min_length=1, max_length=128):
2525
pattern = re.compile(
26-
r"^[\w!#$%&\'*+/=?^_`{|}~.-]+$",
26+
r"^(?!\s)[\w!#$%& \'*+/=?^_`{|}~.-]+(?!\s)$",
2727
flags=re.UNICODE,
2828
)
2929
super().__init__(pattern=pattern)

0 commit comments

Comments
 (0)