Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Forbid non-ASes from registering users whose names begin with '_' #958

Merged
merged 1 commit into from
Jul 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions synapse/handlers/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def check_username(self, localpart, guest_access_token=None,
Codes.INVALID_USERNAME
)

if localpart[0] == '_':
raise SynapseError(
400,
"User ID may not begin with _",
Codes.INVALID_USERNAME
)

user = UserID(localpart, self.hs.hostname)
user_id = user.to_string()

Expand Down