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

Add slash restriction to username validation #197

Merged
merged 3 commits into from
Nov 13, 2021
Merged
Show file tree
Hide file tree
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 nativeauthenticator/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ def get_result_message(
if minimum_password_length > 0:
message = (
"Something went wrong!\nBe sure your username "
"does not contain spaces or commas, your "
"does not contain spaces, commas or slashes, your "
f"password has at least {minimum_password_length} "
"characters and is not too common."
)
# Error if minimum password length is 0.
else:
message = (
"Something went wrong!\nBe sure your username "
"does not contain spaces or commas and your "
"does not contain spaces, commas or slashes and your "
"password is not too common."
)
# If user creation went through & open-signup is enabled, success.
Expand Down
2 changes: 1 addition & 1 deletion nativeauthenticator/nativeauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def change_password(self, username, new_password):
return True

def validate_username(self, username):
invalid_chars = [",", " "]
invalid_chars = [",", " ", "/"]
if any((char in username) for char in invalid_chars):
return False
return super().validate_username(username)
Expand Down