diff --git a/README.md b/README.md index dc3113a..149bb3c 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,11 @@ login by attacking via ssh or another mean. To change your password, you should login in your jupyterhub account, go to `/hub/auth/change-password` and change the password. +#### I'm getting an error when creating my username + +Usernames cannot contain spaces or commas. Please check if your username is free +of these characters. + ## Security When using `FirstUseAuthenticator` it is advised to automatically prepend the diff --git a/firstuseauthenticator/firstuseauthenticator.py b/firstuseauthenticator/firstuseauthenticator.py index d35dab2..4ded579 100644 --- a/firstuseauthenticator/firstuseauthenticator.py +++ b/firstuseauthenticator/firstuseauthenticator.py @@ -93,6 +93,12 @@ class FirstUseAuthenticator(Authenticator): """ return self.db.query(User).filter_by(name=username).first() is not None + def validate_username(self, name): + invalid_chars = [',', ' '] + if any((char in name) for char in invalid_chars): + return False + return super().validate_username() + @gen.coroutine def authenticate(self, handler, data): username = data['username']