diff --git a/hbd/server/http.py b/hbd/server/http.py index 2867c4b..e564bc4 100644 --- a/hbd/server/http.py +++ b/hbd/server/http.py @@ -35,6 +35,10 @@ def _render_template(html_str: str, **context) -> str: SESSION_COOKIE = "hbd_session" +def _gitea_cfg_url(config: dict) -> str: + return config.get("oauth", {}).get("gitea", {}).get("url", "") + + def _get_token(request) -> str: """Extract session token from Bearer header, X-Auth-Token header, or cookie.""" auth = request.headers.get("Authorization", "") @@ -622,6 +626,16 @@ async def start( ) raise resp error = "Invalid username or password." + elif request.rel_url.query.get("error"): + error = "Sign-in failed. Please try again." + + gitea_button = "" + if oauth_mod.is_enabled(config): + gitea_button = f""" +
' + error + '
' if error else ''} + {'Invalid username, password, or OAuth error.
' if error else ''} + {gitea_button}