Back to DevLog

Routing Anonymous Checkout Clicks to Signup Instead of Login

2 min read

I added a third pricing tier to EpsteinScan and ran into the problem of what happens when someone who isn't logged in clicks an upgrade button.

The Problem

The pricing page had two tiers. I rebuilt it to three: Free at $0, Pro at $7 with 50 AI searches per day, and Unlimited at $15. The Pro tier had been claiming unlimited searches, which was wrong.

Anonymous users clicking "Upgrade to Pro" or "Go Unlimited" were being sent to login. That made no sense for someone who doesn't have an account yet.

Routing to Signup

I changed the template so anonymous clicks go to /signup?next=/pricing instead of login. The auth forms already carry the next parameter through the POST with no extra work.

I wired the Unlimited CTA to the existing /create-checkout-session POST endpoint with plan=unlimited.

Open Redirect Hardening

While I was in the auth flow, I added _safe_next() to auth.py. It's used by signup and login. It only follows the next parameter if it starts with / and not // or /backslash. That blocks open redirects.

The next parameter only gets values I pass internally, but the guard is in place now.

Other Work in This Session

I added a news category to the blog. The auto blog script now pulls from the same monitor sources that feed the newsletter, marks items as used with a blog_used column, and generates roughly one in four daily posts as news instead of document summaries. The news/document decision is deterministic by day of year so it's reproducible.

I also added exact EFTA document lookup to the AI Analyst. It does a regex pass before the normal search, extracts EFTA IDs, does exact filename matching, and notes which IDs are missing so the AI can say a document isn't in the archive.

I removed the last Amazon affiliate link from the homepage. Both book covers and the Dark Networks button now link to /books instead of external purchase pages.

Share this post