-
Notifications
You must be signed in to change notification settings - Fork 69
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
Signup error #109
Signup error #109
Conversation
nativeauthenticator/handlers.py
Outdated
elif self.authenticator.open_signup: | ||
alert = 'alert-success' | ||
message = ('The signup was successful. You can now go to ' | ||
'home page and log in the system') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this part under the "if taken" branch so that it would not report success on open signup, even when the name was, in fact, already taken.
user = self.authenticator.create_user(**user_info) | ||
name = self.authenticator.user_exists(user_info['username']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name was confusing, this is a boolean that indicates if the name is taken, not the name as a string.
alert = 'alert-danger' | ||
pw_len = self.authenticator.minimum_password_length | ||
taken = self.authenticator.user_exists(username) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the line that caused the errors. "username" here is a boolean indicating wether the name exists in the system, but it is used like a string containing a username. Apart from this being nonsensical, during jupyterhub username normalisation, .lower()
is called on this variable, which throws an error because that's not defined on booleans, leading to a 500 error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a great catch
alert = 'alert-danger' | ||
pw_len = self.authenticator.minimum_password_length | ||
taken = self.authenticator.user_exists(username) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a great catch
This is basically a follow-up PR to #102, which introduced a bug that now leads to 500 errors (instead of sensible error messages) when signing up with a taken username. This PR removes this bug.
There are also a few minor improvements that I found along the way. These can be factored out if necessary.