Merge pull request #11 from leportella/add-name-sanitization
add name sanitization
This commit is contained in:
commit
c1c4ce8e94
2 changed files with 11 additions and 0 deletions
|
@ -52,6 +52,11 @@ login by attacking via ssh or another mean.
|
||||||
To change your password, you should login in your jupyterhub account,
|
To change your password, you should login in your jupyterhub account,
|
||||||
go to `<your_server_ip>/hub/auth/change-password` and change the password.
|
go to `<your_server_ip>/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
|
## Security
|
||||||
|
|
||||||
When using `FirstUseAuthenticator` it is advised to automatically prepend the
|
When using `FirstUseAuthenticator` it is advised to automatically prepend the
|
||||||
|
|
|
@ -93,6 +93,12 @@ class FirstUseAuthenticator(Authenticator):
|
||||||
"""
|
"""
|
||||||
return self.db.query(User).filter_by(name=username).first() is not None
|
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
|
@gen.coroutine
|
||||||
def authenticate(self, handler, data):
|
def authenticate(self, handler, data):
|
||||||
username = data['username']
|
username = data['username']
|
||||||
|
|
Loading…
Add table
Reference in a new issue