Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

🐛 check if the username begins or ends with a period #368

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions openbook_auth/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@


def username_characters_validator(username):
if not re.match('^[a-zA-Z0-9_.]*$', username):
if not re.match('^(?!\.)[a-zA-Z0-9_.]*(?<!\.)$', username):
raise ValidationError(
_('Usernames can only contain alphanumeric characters, periods and underscores.'),
_('Usernames can only contain alphanumeric characters, periods and underscores. They must not begin or end with a period.'),
)


Expand Down