Flow: enter email → magic link → verified → Stripe checkout → dashboard - SessionsController: new/create (send magic link), sent, verify, destroy - Customer model: generate_magic_token!, magic_token_valid?, verify_email! - Migration: magic_token, magic_token_expires_at, email_verified_at + unique indexes - CustomerMailer + mailer layout with magic link email (html + text) - CheckoutController: GET /checkout/start requires auth, passes customer_id as Stripe metadata; webhook finds customer by metadata and updates record - DashboardController: requires auth, uses current_customer from session - ApplicationController: current_customer, require_auth, redirect_after_auth (stores return_to so verify sends user back to where they were headed) - Resend gem + initializer; production uses :resend delivery method - Dev logs magic link URL to Rails logger instead of sending email - Pricing page: simple link to /checkout/start (no more JS fetch) - Layout: Sign in / Dashboard / Sign out nav links Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
664 B
Ruby
20 lines
664 B
Ruby
Rails.application.routes.draw do
|
|
root "pages#home"
|
|
get "/pricing", to: "pages#pricing"
|
|
|
|
# Auth
|
|
get "/login", to: "sessions#new", as: :login
|
|
post "/login", to: "sessions#create"
|
|
get "/login/sent", to: "sessions#sent", as: :login_sent
|
|
get "/verify", to: "sessions#verify", as: :verify
|
|
get "/logout", to: "sessions#destroy", as: :logout
|
|
|
|
# Dashboard (requires auth)
|
|
get "/dashboard", to: "dashboard#show"
|
|
|
|
# Checkout
|
|
get "/checkout/start", to: "checkout#start", as: :checkout_start
|
|
post "/checkout/webhook", to: "checkout#webhook"
|
|
|
|
get "up" => "rails/health#show", as: :rails_health_check
|
|
end
|