mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 15:33:02 +00:00
use find_user in POST /spawn/:user
so we get a 404 for missing users
This commit is contained in:
@@ -139,7 +139,9 @@ class SpawnHandler(BaseHandler):
|
|||||||
if for_user is not None and for_user != user.name:
|
if for_user is not None and for_user != user.name:
|
||||||
if not user.admin:
|
if not user.admin:
|
||||||
raise web.HTTPError(403, "Only admins can spawn on behalf of other users")
|
raise web.HTTPError(403, "Only admins can spawn on behalf of other users")
|
||||||
user = self.user_from_username(for_user)
|
user = self.find_user(for_user)
|
||||||
|
if user is None:
|
||||||
|
raise web.HTTPError(404, "No such user: %s" % for_user)
|
||||||
if not self.allow_named_servers and user.running:
|
if not self.allow_named_servers and user.running:
|
||||||
url = user.url
|
url = user.url
|
||||||
self.log.warning("User is already running: %s", url)
|
self.log.warning("User is already running: %s", url)
|
||||||
|
Reference in New Issue
Block a user