diff --git a/backend/main.py b/backend/main.py index 5b4ad2f..c8e0935 100644 --- a/backend/main.py +++ b/backend/main.py @@ -89,14 +89,17 @@ return oauth.verify_identity(request.cookies.get(oauth.IDENTITY_COOKIE, "")) +@app.get("/login") +def login_page(): + """Explicit provider choice: X or Instagram (button disabled until configured).""" + return FileResponse(FRONTEND_DIR / "login.html") + + @app.get("/test") -def test_page(request: Request, anon: int = 0): - """Auth-before-test: no valid identity cookie -> redirect to X login. - ?anon=1 explicitly opts out (anonymous result, not bound to identity).""" - if not anon and _identity_from(request) is None: - url = oauth.x_authorize_url() - if url is not None: - return RedirectResponse(url[0], status_code=303) +def test_page(request: Request): + """Auth-before-test: no valid identity cookie -> explicit provider choice.""" + if _identity_from(request) is None: + return RedirectResponse("/login", status_code=303) return FileResponse(FRONTEND_DIR / "test.html") @@ -310,18 +313,19 @@ # --- identity binding (phase 2 scaffolding) ----------------------------------- -def _claim_error_page(result_id: str, provider: str) -> HTMLResponse: - """Standalone error page: claim failed, result untouched and still verifiable.""" +def _login_error_page(provider: str) -> HTMLResponse: + """Standalone error page: login failed, no identity cookie is set.""" body = ( '
' - '' + provider + ' did not return a usable profile. Your result is unchanged ' - 'and still verifiable. You can try again from the result page.
' - '' + '' + provider + ' did not return a usable profile. No result was ' + 'affected — you simply are not logged in. You can try again.
' + 'Back to login · ' + 'Back to home
' '