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

Signup error #109

Merged
merged 5 commits into from
May 23, 2020
Merged

Signup error #109

merged 5 commits into from
May 23, 2020

Conversation

lambdaTotoro
Copy link
Collaborator

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.

  • If the chosen username is taken, the software now also errors, even if during open signup.
  • Corrected typos and grammar in a few places.

Comment on lines 71 to 74
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')
Copy link
Collaborator Author

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'])
Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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.

Copy link
Collaborator

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)
Copy link
Collaborator

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

@leportella leportella merged commit d99d23b into master May 23, 2020
@leportella leportella deleted the signup-error branch May 23, 2020 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants