Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update bad/restricted username message #270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions ocflib/account/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,13 @@ def validate_username(username, realname):
except ValueError as ex:
raise ValidationError(str(ex))

if any(word in username for word in BAD_WORDS):
raise ValidationWarning('Username {} contains bad words.'.format(username))
for word in BAD_WORDS:
if word in username:
raise ValidationWarning('Username {} contains bad word: {}'.format(username, word))

if any(word in username for word in RESTRICTED_WORDS):
raise ValidationWarning('Username {} contains restricted words.'.format(username))
for word in RESTRICTED_WORDS:
if word in username:
raise ValidationWarning('Username {} contains restricted word: {}'.format(username, word))


def validate_email(email):
Expand Down