Skip to content

Commit

Permalink
Add "@" sign to 'forbidden' character
Browse files Browse the repository at this point in the history
  • Loading branch information
raethlein committed Nov 18, 2019
1 parent c6bb136 commit 45f004a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions resources/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
def custom_normalize_username(self, username):
username = original_normalize_username(self, username)
more_than_one_forbidden_char = False
for forbidden_username_char in [" ", ",", ";", ".", "-"]:
for forbidden_username_char in [" ", ",", ";", ".", "-", "@"]:
# Replace special characters with a non-special character. Cannot just be empty, like "", because then it could happen that two distinct user names are transformed into the same username.
# Example: "foo, bar" and "fo, obar" would both become "foobar".
replace_char = "0"
# If there is more than one special character, just replace one of them. Otherwise, "foo, bar" would become "foo00bar" instead of "foo0bar"
if more_than_one_forbidden_char == True:
replace_char = ""
temp_username = username
username = username.replace(forbidden_username_char, replace_char)
username = username.replace(forbidden_username_char, replace_char, 1)
if username != temp_username:
more_than_one_forbidden_char = True

Expand Down

0 comments on commit 45f004a

Please sign in to comment.