set cookie on singleuser when authenticated with ?token=...

Allows `/user/name?token=...` URL to login users for more than one request.

matches token behavior of regular notebook server.
This commit is contained in:
Min RK
2017-08-30 14:07:20 +02:00
parent e19296a230
commit 7a41d24606

View File

@@ -731,6 +731,11 @@ class HubAuthenticated(object):
except Exception:
self._hub_auth_user_cache = None
raise
token = self.get_argument('token', '')
if user_model and token and getattr(self, '_token_authenticated', False):
# authenticated via `?token=`
# set a cookie for future requests
self.hub_auth.set_cookie(self, token)
return self._hub_auth_user_cache