Merge pull request #2881 from minrk/auth-state-earlier

trigger auth_state_hook prior to options form, add auth_state to template namespace
This commit is contained in:
Min RK
2020-01-17 12:35:33 +01:00
committed by GitHub
5 changed files with 53 additions and 15 deletions

View File

@@ -530,12 +530,17 @@ class User:
# trigger pre-spawn hook on authenticator
authenticator = self.authenticator
try:
spawner._start_pending = True
if authenticator:
# pre_spawn_start can thow errors that can lead to a redirect loop
# if left uncaught (see https://github.com/jupyterhub/jupyterhub/issues/2683)
await maybe_future(authenticator.pre_spawn_start(self, spawner))
spawner._start_pending = True
# trigger auth_state hook
auth_state = await self.get_auth_state()
await spawner.run_auth_state_hook(auth_state)
# update spawner start time, and activity for both spawner and user
self.last_activity = (
spawner.orm_spawner.started