Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions hermes_cli/dashboard_auth/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ async def auth_login(request: Request, provider: str, next: str = ""):

try:
ls = p.start_login(redirect_uri=_redirect_uri(request))
except NotImplementedError:
# Password-only providers (e.g. BasicAuthProvider) do not support
# OAuth redirect flows. Redirect to the server-rendered login
# page instead of crashing with a 500.
from urllib.parse import quote

next_path = request.query_params.get("next", "")
safe = _validate_post_login_target(next_path)
target = f"/login?next={quote(safe, safe='')}" if safe else "/login"
return RedirectResponse(url=target, status_code=302)
except ProviderError as e:
audit_log(
AuditEvent.LOGIN_FAILURE,
Expand Down