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

fixed 'change password' feature for Jupyterhub version 1.0.0 #23

Merged
merged 1 commit into from
Aug 24, 2019

Conversation

ABVitali
Copy link

Trying to use firstuseauthenticator with Jupyterhub version 1.0.0 locally I had a problem when I tested password change.
Unfortunately, I don't remember in which other issue I found the explanation that I used to apply the change to the code but I tested it and it seems to work.
It is my first try of a contribution so please be patient if there is something missing in the contribution procedure.

The error I had in jupyterhub logs with the last version of the code (0.12) was:

I 2019-08-24 08:35:26.827 JupyterHub log:174] 200 POST /hub/api/oauth2/token (alessandro@172.20.0.4) 41.31ms
jupyterhub | [I 2019-08-24 08:35:26.863 JupyterHub log:174] 200 GET /hub/api/authorizations/token/[secret] (alessandro@172.20.0.4) 30.91ms
jupyterhub | [I 2019-08-24 08:35:57.028 JupyterHub log:174] 200 GET /hub/auth/change-password (alessandro@172.20.0.3) 38.91ms
jupyterhub | [E 2019-08-24 08:36:02.139 JupyterHub web:1788] Uncaught exception POST /hub/auth/change-password (172.20.0.3)
jupyterhub |     HTTPServerRequest(protocol='http', host='127.0.0.1:8080', method='POST', uri='/hub/auth/change-password', version='HTTP/1.1', remote_ip='172.20.0.3')
jupyterhub |     Traceback (most recent call last):
jupyterhub |       File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1699, in _execute
jupyterhub |         result = await result
jupyterhub |       File "/opt/conda/lib/python3.6/site-packages/firstuseauthenticator/firstuseauthenticator.py", line 53, in post
jupyterhub |         self.authenticator.reset_password(user.name, new_password)
jupyterhub |     AttributeError: 'coroutine' object has no attribute 'name'
jupyterhub |     
jupyterhub | [E 2019-08-24 08:36:02.151 JupyterHub log:166] {
jupyterhub |       "Upgrade-Insecure-Requests": "1",
jupyterhub |       "Cookie": "jupyterhub-hub-login=[secret]; jupyterhub-session-id=[secret]; _xsrf=[secret]",
jupyterhub |       "Connection": "close",
jupyterhub |       "Content-Length": "16",
jupyterhub |       "Content-Type": "application/x-www-form-urlencoded",
jupyterhub |       "Referer": "http://127.0.0.1:8080/hub/auth/change-password",
jupyterhub |       "Accept-Encoding": "gzip, deflate",
jupyterhub |       "Accept-Language": "en-US,en;q=0.5",
jupyterhub |       "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
jupyterhub |       "User-Agent": "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0",
jupyterhub |       "Host": "127.0.0.1:8080"
jupyterhub |     }

After the fix I have:

jupyterhub | [I 2019-08-24 08:49:42.041 JupyterHub log:174] 200 POST /hub/api/oauth2/token (ale@172.20.0.4) 44.71ms
jupyterhub | [I 2019-08-24 08:49:42.080 JupyterHub log:174] 200 GET /hub/api/authorizations/token/[secret] (ale@172.20.0.4) 31.65ms
jupyterhub | [I 2019-08-24 08:49:46.352 JupyterHub log:174] 200 GET /hub/auth/change-password (ale@172.20.0.3) 35.87ms
jupyterhub | [I 2019-08-24 08:49:50.866 JupyterHub log:174] 200 POST /hub/auth/change-password (ale@172.20.0.3) 263.09ms

and the web page correctly says password changed instead of internal server error 500

@GeorgianaElena GeorgianaElena merged commit d032b7f into jupyterhub:master Aug 24, 2019
@GeorgianaElena
Copy link
Member

This is awesome 🍀 ! Thanks a lot @ABVitali and congratulations on your first PR 🚀 🎊

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