carlos / platform Public

console: bought domains with DNS hosted elsewhere; Move to Carloku

A registration with no zone here (a transfer in) shows as bought with
its DNS hosted elsewhere: Addresses with Detach and an Add an address
link, expiry and next year's price, Registered to, and the records to
set at its DNS host. No Point, retry, move hint or managed-DNS line.
Point refuses it with a draft message before any write.

Registered-elsewhere domains offer owners Move to Carloku when buying
is ready; a live transfer shows Moving here and a link to its card on
the Domains card and the domain page instead. Strings are drafts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 13c3506dd1382923ec502acf082531149d0232c6 parent 94ea346
8 files changed, +392 −33
  • internal/console/accountdomains_copy.go +42 −0
  • internal/console/accountdomainspage.go +77 −16
  • internal/console/accountdomainspage_test.go +208 −0
  • internal/console/domainpoint.go +11 −4
  • internal/console/domainpoint_test.go +25 −0
  • internal/console/domaintransfer_test.go +4 −3
  • internal/console/templates/account_domain.html +20 −6
  • internal/console/templates/account_domains.html +5 −4
diff --git a/internal/console/accountdomains_copy.go b/internal/console/accountdomains_copy.go
index 6de934681..887a4ce51 100644
--- a/internal/console/accountdomains_copy.go
+++ b/internal/console/accountdomains_copy.go
@@ -212,3 +212,45 @@ var purchaseReadyCopy = struct {
}{
OpenDomain: "Open {domain}",
}
+
+// DRAFT copy for transfers in (spec §12.3), pending copy review. No
+// registrar or DNS host is named; nothing says the domain renews.
+
+// domainDNSElsewhereCopy is a bought domain with no zone here (moved in by
+// a transfer, its DNS hosted elsewhere): its chip, its DNS line, the note
+// over its records to set (at its DNS host, not where it is registered),
+// the owner's way to attach an address, and Point's refusal (lower case,
+// as the point door's other refusals). {domain} is filled by the page.
+var domainDNSElsewhereCopy = struct {
+ Chip, Line, RecordsNote, AddAddress, PointRefused string
+}{
+ Chip: "DNS hosted elsewhere",
+ Line: "{domain}’s DNS is hosted elsewhere, not here.",
+ RecordsNote: "{domain}’s DNS is hosted elsewhere, not here. Add these records at its DNS host. Checks run every few minutes.",
+ AddAddress: "Add an address",
+ PointRefused: "this domain’s DNS is hosted elsewhere, so it can’t be pointed at an app here. attach its addresses on the app instead",
+}
+
+// domainMoveCopy is Move to Carloku on a domain registered elsewhere (its
+// page's Registration section and its card's link), and a domain whose
+// transfer is under way (its chip and the link to its card).
+var domainMoveCopy = struct {
+ Title, Move, Note, Moving, SeeMove string
+}{
+ Title: "Registration",
+ Move: "Move to Carloku",
+ Note: "Move the registration here to keep it with your other domains. Its DNS and email don’t change.",
+ Moving: "Moving here",
+ SeeMove: "See the move",
+}
+
+// domainTransferStatusCopy is a live transfer's one-line status on its
+// domain's card and page. A state not listed reads as waiting.
+var domainTransferStatusCopy = map[PurchaseState]string{
+ PurchaseAwaitingPayment: "Waiting for payment",
+ PurchaseAuthorised: "Sending the transfer",
+ PurchaseTransferSubmitting: "Sending the transfer",
+ PurchaseTransferPending: "Waiting for the current registrar",
+ PurchaseTransferRefunding: "Refunding your payment",
+ "": "Waiting for the current registrar",
+}
diff --git a/internal/console/accountdomainspage.go b/internal/console/accountdomainspage.go
index 07f1c607a..319224581 100644
--- a/internal/console/accountdomainspage.go
+++ b/internal/console/accountdomainspage.go
@@ -5,8 +5,10 @@ package console
// accountDomain (accountdomains.go). Neither needs buying configured: a
// domain registered elsewhere needs nothing but its addresses. Only the
// owner's actions that go through buying (Buy a domain, Point at an app,
-// the purchase card, the hint on moving a bought domain) wait on
-// domainBuyReady. Nothing offers a card change beside next year's price
+// the purchase card, the hint on moving a bought domain, Move to Carloku)
+// wait on domainBuyReady. A bought domain with no zone here (a transfer in,
+// spec §12.3) is shown as bought, but with its DNS hosted elsewhere: the
+// records to set there and no Point. Nothing offers a card change beside next year's price
// until renewals exist (Plan 3). Every form posts
// to an existing door: an app's attach, detach and point.
@@ -42,6 +44,13 @@ func (p page) DomainsCopy() any { return domainsPageCopy }
// AccountBuyCopy is the account buy page's and saved contacts' strings.
func (p page) AccountBuyCopy() any { return accountBuyCopy }
+// DNSElsewhereCopy is a bought domain with no zone here: its chip and its
+// Add an address link.
+func (p page) DNSElsewhereCopy() any { return domainDNSElsewhereCopy }
+
+// DomainMoveCopy is Move to Carloku and a live transfer's words.
+func (p page) DomainMoveCopy() any { return domainMoveCopy }
+
// domainAddressView is one address row.
type domainAddressView struct {
Host, App, AppHref string
@@ -55,7 +64,9 @@ type domainAddressView struct {
type domainCardView struct {
Domain, Href string
Bought bool // registered here
+ DNSElsewhere bool // registered here with no zone here (moved in by a transfer): nothing to point
Buying bool // a purchase not finished yet
+ Moving bool // that purchase is a transfer in
PurchaseHref string // its card, for an owner who can open it
PurchaseStatus string
ExpiresText string // "" when not bought here
@@ -64,11 +75,13 @@ type domainCardView struct {
Price string // next year's, "" when the catalog has none in the account's currency
Addresses []domainAddressView
PointHref string // the owner's way to the picker, on an unpointed bought domain
+ MoveHref string // the owner's Move to Carloku, on a domain registered elsewhere with nothing in flight
live, total int // addresses live, of those on apps not in Trash
}
-// Unpointed is a bought domain with no addresses.
-func (c domainCardView) Unpointed() bool { return c.Bought && len(c.Addresses) == 0 }
+// Unpointed is a bought domain with no addresses that pointing would give
+// some: not one whose DNS is hosted elsewhere.
+func (c domainCardView) Unpointed() bool { return c.Bought && !c.DNSElsewhere && len(c.Addresses) == 0 }
// domainAppAction is one app an owner can send a form to.
type domainAppAction struct{ App, Action, Label string }
@@ -117,6 +130,11 @@ type domainPageView struct {
Records []domainRecordRow
Guidance []string // a host whose advice has no records to list
RecordsNote string
+ // DNSElsewhereLine says a bought domain's DNS is hosted elsewhere, and
+ // AddAddressHref is the owner's way to the attach form for it: Point
+ // is not offered for such a domain (spec §12.3).
+ DNSElsewhereLine string
+ AddAddressHref string
}
// domainRecordRow is one record to set at the other registrar. Or marks
@@ -257,7 +275,12 @@ func (s *Server) domainCardFor(acct *Account, c domainCard, currency string, own
}
if p := c.Purchase; p != nil {
v.Buying = true
- v.PurchaseStatus = purchaseCard(p, "").Status
+ v.Moving = p.Kind == PurchaseKindTransfer
+ if v.Moving {
+ v.PurchaseStatus = transferStatusLine(p.State)
+ } else {
+ v.PurchaseStatus = purchaseCard(p, "").Status
+ }
if owner && ready {
v.PurchaseHref = domainPurchaseURL(acct.Sqid, p.ID)
}
@@ -266,13 +289,25 @@ func (s *Server) domainCardFor(acct *Account, c domainCard, currency string, own
v.expires = r.Expires.UTC()
v.ExpiresText, v.ExpiresISO = v.expires.Format("2 Jan 2006"), v.expires.Format("2006-01-02")
v.Price = s.domainRenewPrice(c.Domain, currency)
- if owner && ready && !v.Buying && len(v.Addresses) == 0 {
+ v.DNSElsewhere = r.ZoneID == ""
+ if owner && ready && !v.Buying && !v.DNSElsewhere && len(v.Addresses) == 0 {
v.PointHref = v.Href + "#point"
}
+ } else if owner && ready && !v.Buying && domainRegistrable(c.Domain) != "" {
+ // Registered elsewhere, nothing in flight: Task 9's transfer form.
+ v.MoveHref = v.Href + "/transfer"
}
return v
}
+// transferStatusLine is a live transfer's status on its domain's card.
+func transferStatusLine(state PurchaseState) string {
+ if msg, ok := domainTransferStatusCopy[state]; ok {
+ return msg
+ }
+ return domainTransferStatusCopy[""]
+}
+
// detachableApps is the apps whose detach door an owner can use.
func detachableApps(apps []string) map[string]bool {
out := make(map[string]bool, len(apps))
@@ -439,6 +474,10 @@ func (s *Server) domainPage(ctx context.Context, acct *Account, owner bool, c do
if cv.Price != "" {
v.Tiles = append(v.Tiles, domainTile{Label: domainsPageCopy.TilePrice, Value: cv.Price})
}
+ if cv.DNSElsewhere {
+ s.domainPageDNSElsewhere(ctx, acct, owner, c, v)
+ return v
+ }
// Moving a bought domain is detach, then point: say so beside Detach
// where pointing is possible.
if owner && ready && !cv.Buying {
@@ -457,20 +496,42 @@ func (s *Server) domainPage(ctx context.Context, acct *Account, owner bool, c do
v.PointApps = domainAppActions(acct, []string{app}, "point", domainsPageCopy.PointToApp)
v.PointNote = domainsFill(domainPointRetryCopy.Note, "{domain}", c.Domain, "{app}", app)
}
- if rc := c.Registration.Registrant; rc.FirstName != "" || rc.LastName != "" || rc.Email != "" {
- // The name for everyone; the rest is personal data, owners only, as
- // saved contacts are (spec §11.5).
- v.Registrant = []domainTile{{Label: domainsPageCopy.Name, Value: strings.TrimSpace(rc.FirstName + " " + rc.LastName)}}
- if owner {
- v.Registrant = append(v.Registrant,
- domainTile{Label: domainsPageCopy.Email, Value: rc.Email},
- domainTile{Label: domainsPageCopy.Country, Value: countryName(rc.Country)})
- }
- }
+ v.Registrant = domainRegistrant(c.Registration.Registrant, owner)
v.Managed = len(cv.Addresses) > 0
return v
}
+// domainPageDNSElsewhere fills a bought domain's page whose DNS is hosted
+// elsewhere (a transfer in, spec §12.3): Registered to, the records to set
+// at its DNS host (the registered-elsewhere advice), the line saying where
+// its DNS is, and for owners the way to attach an address. No Point, no
+// pointing retry, no move hint, and nothing says its records are managed.
+func (s *Server) domainPageDNSElsewhere(ctx context.Context, acct *Account, owner bool, c domainCard, v *domainPageView) {
+ v.Registrant = domainRegistrant(c.Registration.Registrant, owner)
+ v.Records, v.Guidance = s.domainRecordsToSet(ctx, c.Addresses)
+ v.RecordsNote = domainsFill(domainDNSElsewhereCopy.RecordsNote, "{domain}", c.Domain)
+ v.DNSElsewhereLine = domainsFill(domainDNSElsewhereCopy.Line, "{domain}", c.Domain)
+ if owner {
+ v.AddAddressHref = domainsBase(acct) + "/domains#add"
+ }
+}
+
+// domainRegistrant is Registered to: the name for everyone; the rest is
+// personal data, owners only, as saved contacts are (spec §11.5). nil when
+// none is recorded.
+func domainRegistrant(rc registrar.Contact, owner bool) []domainTile {
+ if rc.FirstName == "" && rc.LastName == "" && rc.Email == "" {
+ return nil
+ }
+ out := []domainTile{{Label: domainsPageCopy.Name, Value: strings.TrimSpace(rc.FirstName + " " + rc.LastName)}}
+ if owner {
+ out = append(out,
+ domainTile{Label: domainsPageCopy.Email, Value: rc.Email},
+ domainTile{Label: domainsPageCopy.Country, Value: countryName(rc.Country)})
+ }
+ return out
+}
+
// pointRetryApp is the app a bought domain's pointing is unfinished at, or
// "": the apex and www addresses (apps not in Trash) all on one app, with
// one of the two missing or either still pending. No such address, two
diff --git a/internal/console/accountdomainspage_test.go b/internal/console/accountdomainspage_test.go
index 340ab920d..37d516c05 100644
--- a/internal/console/accountdomainspage_test.go
+++ b/internal/console/accountdomainspage_test.go
@@ -784,3 +784,211 @@ func TestDomainPageOffersPointRetryWhenPartialOrPending(t *testing.T) {
}
}
}
+
+// adTransferred records domain as moved here by a transfer: registered to
+// acct, with no Carloku zone (its DNS is hosted elsewhere).
+func adTransferred(t *testing.T, fx *consoleFixture, acct *Account, domain string, expires time.Time) {
+ t.Helper()
+ if err := fx.st.AddDomainRegistration(DomainRegistration{Domain: domain, AccountID: acct.ID, RegistrarID: "reg-" + domain,
+ ZoneID: "", Expires: expires, Registrant: purchaseContact()}); err != nil {
+ t.Fatal(err)
+ }
+}
+
+// inOrder fails unless every want appears in main, in order.
+func inOrder(t *testing.T, label, main string, want ...string) {
+ t.Helper()
+ at := 0
+ for _, w := range want {
+ i := strings.Index(main[at:], w)
+ if i < 0 {
+ t.Fatalf("%s: after offset %d the page lacks %q:\n%s", label, at, w, main)
+ }
+ at += i + len(w)
+ }
+}
+
+func TestTransferredDomainPageShowsDNSElsewhere(t *testing.T) {
+ f := adPurchaseFixture(t)
+ fx, acct := f.consoleFixture, f.acct
+ fx.srv.cfg.EdgeIPs = []string{"192.0.2.10"}
+ base := "/a/" + acct.Sqid
+ adTransferred(t, fx, acct, "moved.com", time.Now().AddDate(1, 0, 0))
+ adClaim(t, fx, acct, "kass", "docs.moved.com")
+ adTransferred(t, fx, acct, "bare.com", time.Now().AddDate(1, 0, 0))
+ esc := func(s string, kv ...string) string { return html.EscapeString(domainsFill(s, kv...)) }
+ addLink := `href="` + base + `/domains#add">` + domainDNSElsewhereCopy.AddAddress + `</a>`
+
+ owner := adSignIn(t, fx, adOwner(acct))
+ status, body := adGet(t, fx, owner, acct, "/domains/moved.com")
+ if status != http.StatusOK {
+ t.Fatalf("GET moved.com = %d:\n%s", status, body)
+ }
+ main := mainOf(t, body)
+ inOrder(t, "moved.com", main,
+ "<h1>moved.com</h1>",
+ domainsPageCopy.BoughtHere,
+ domainDNSElsewhereCopy.Chip,
+ "<h2>"+domainsPageCopy.TileExpires+"</h2>",
+ "<h2>"+domainsPageCopy.TilePrice+"</h2>",
+ "$18",
+ "<h2>"+domainsPageCopy.Addresses+"</h2>",
+ `<code class="envvar-name">docs.moved.com</code>`,
+ `action="`+base+`/apps/kass/domains/detach"`,
+ addLink,
+ "<h2>"+domainsPageCopy.RegisteredTo+"</h2>",
+ "<dd>Jane Buyer</dd>",
+ "<h2>"+domainsPageCopy.RecordsToSet+"</h2>",
+ esc(domainDNSElsewhereCopy.RecordsNote, "{domain}", "moved.com"),
+ )
+ if !regexp.MustCompile(`<td><code>docs.moved.com</code></td>\s*<td>A</td>\s*<td><code>192.0.2.10</code></td>`).MatchString(main) {
+ t.Errorf("records table lacks docs.moved.com A 192.0.2.10:\n%s", main)
+ }
+ if !strings.Contains(main, esc(domainDNSElsewhereCopy.Line, "{domain}", "moved.com")) {
+ t.Errorf("no DNS hosted elsewhere line:\n%s", main)
+ }
+ banned := []string{`id="point"`, "/domains/point", domainsPageCopy.DNSManaged, domainsPageCopy.MoveHint, domainsPageCopy.NotPointed,
+ esc(domainsPageCopy.RecordsNote, "{domain}", "moved.com"), "/transfer", domainMoveCopy.Move}
+ for _, b := range banned {
+ if strings.Contains(main, b) {
+ t.Errorf("moved.com page shows %q", b)
+ }
+ }
+
+ // No addresses yet: still no Point, and the way in is Add an address.
+ _, body = adGet(t, fx, owner, acct, "/domains/bare.com")
+ main = mainOf(t, body)
+ for _, want := range []string{domainDNSElsewhereCopy.Chip, "<h2>" + domainsPageCopy.Addresses + "</h2>", addLink,
+ esc(domainDNSElsewhereCopy.Line, "{domain}", "bare.com")} {
+ if !strings.Contains(main, want) {
+ t.Errorf("bare.com page lacks %q:\n%s", want, main)
+ }
+ }
+ for _, b := range append(banned, "<h2>"+domainsPageCopy.RecordsToSet+"</h2>") {
+ if strings.Contains(main, b) {
+ t.Errorf("bare.com page shows %q", b)
+ }
+ }
+
+ // Its card on the Domains page: bought, DNS elsewhere, no Point.
+ _, body = adGet(t, fx, owner, acct, "/domains")
+ card := adSection(t, mainOf(t, body), "bare.com")
+ if !strings.Contains(card, domainsPageCopy.BoughtHere) || !strings.Contains(card, domainDNSElsewhereCopy.Chip) {
+ t.Errorf("bare.com card lacks its chips:\n%s", card)
+ }
+ for _, b := range []string{"#point", domainsPageCopy.NotPointed, domainsPageCopy.PointAtApp} {
+ if strings.Contains(card, b) {
+ t.Errorf("bare.com card shows %q:\n%s", b, card)
+ }
+ }
+
+ // A member sees the page and its records, without the owner's forms.
+ member := adMember(t, fx, acct)
+ _, body = adGet(t, fx, member, acct, "/domains/moved.com")
+ main = mainOf(t, body)
+ if !strings.Contains(main, esc(domainDNSElsewhereCopy.Line, "{domain}", "moved.com")) || !strings.Contains(main, "<td><code>docs.moved.com</code></td>") {
+ t.Errorf("member's page lacks the DNS line or records:\n%s", main)
+ }
+ for _, b := range []string{"/domains/detach", domainDNSElsewhereCopy.AddAddress, "/domains/point"} {
+ if strings.Contains(main, b) {
+ t.Errorf("member's moved.com page shows %q", b)
+ }
+ }
+}
+
+func TestElsewhereDomainOffersMoveToCarloku(t *testing.T) {
+ f := adPurchaseFixture(t)
+ fx, acct := f.consoleFixture, f.acct
+ base := "/a/" + acct.Sqid
+ adClaim(t, fx, acct, "kass", "www.example.org")
+ adBought(t, fx, acct, "bought.com", time.Now().AddDate(1, 0, 0))
+ move := `href="` + base + `/domains/example.org/transfer"`
+
+ owner := adSignIn(t, fx, adOwner(acct))
+ _, body := adGet(t, fx, owner, acct, "/domains")
+ main := mainOf(t, body)
+ if card := adSection(t, main, "example.org"); !strings.Contains(card, move) || !strings.Contains(card, domainMoveCopy.Move) {
+ t.Errorf("owner's elsewhere card lacks Move to Carloku:\n%s", card)
+ }
+ if card := adSection(t, main, "bought.com"); strings.Contains(card, "/transfer") {
+ t.Errorf("a bought domain offers a move:\n%s", card)
+ }
+ status, body := adGet(t, fx, owner, acct, "/domains/example.org")
+ if status != http.StatusOK {
+ t.Fatalf("GET example.org = %d:\n%s", status, body)
+ }
+ main = mainOf(t, body)
+ for _, want := range []string{"<h2>" + domainMoveCopy.Title + "</h2>", move, domainMoveCopy.Move, html.EscapeString(domainMoveCopy.Note)} {
+ if !strings.Contains(main, want) {
+ t.Errorf("owner's elsewhere page lacks %q:\n%s", want, main)
+ }
+ }
+ if _, body = adGet(t, fx, owner, acct, "/domains/bought.com"); strings.Contains(mainOf(t, body), "/transfer") {
+ t.Error("a bought domain's page offers a move")
+ }
+
+ member := adMember(t, fx, acct)
+ for _, path := range []string{"/domains", "/domains/example.org"} {
+ _, body := adGet(t, fx, member, acct, path)
+ if main := mainOf(t, body); strings.Contains(main, "/transfer") || strings.Contains(main, domainMoveCopy.Move) {
+ t.Errorf("member's %s offers a move:\n%s", path, main)
+ }
+ }
+
+ // The buy door off: no move either.
+ fx2, acct2 := adFixture(t, consoleFixtureOptions{})
+ adApp(t, fx2, acct2, "a")
+ adClaim(t, fx2, acct2, "a", "www.example.org")
+ if fx2.srv.domainBuyReady() {
+ t.Fatal("buying is configured")
+ }
+ owner2 := adSignIn(t, fx2, adOwner(acct2))
+ for _, path := range []string{"/domains", "/domains/example.org"} {
+ _, body := adGet(t, fx2, owner2, acct2, path)
+ if main := mainOf(t, body); strings.Contains(main, "/transfer") || strings.Contains(main, domainMoveCopy.Move) {
+ t.Errorf("buy door off: %s offers a move:\n%s", path, main)
+ }
+ }
+}
+
+func TestDomainWithLiveTransferLinksItsCard(t *testing.T) {
+ f := adPurchaseFixture(t)
+ fx, acct := f.consoleFixture, f.acct
+ adClaim(t, fx, acct, "kass", "www.example.org")
+ now := time.Now()
+ p := DomainPurchase{ID: newDomainPurchaseID(), Kind: PurchaseKindTransfer, AccountID: acct.ID, Domain: "example.org", Currency: "usd",
+ Amount: 1800, State: PurchaseTransferPending, CheckoutExpires: now.Add(time.Hour), CreatedAt: now, UpdatedAt: now}
+ if err := fx.st.CreateDomainPurchase(p); err != nil {
+ t.Fatal(err)
+ }
+ cardLink := `href="` + domainPurchaseURL(acct.Sqid, p.ID) + `"`
+ moving := `<span class="chip chip-canary">` + domainMoveCopy.Moving + `</span>`
+ status := html.EscapeString(domainTransferStatusCopy[PurchaseTransferPending])
+
+ owner := adSignIn(t, fx, adOwner(acct))
+ _, body := adGet(t, fx, owner, acct, "/domains")
+ card := adSection(t, mainOf(t, body), "example.org")
+ _, body = adGet(t, fx, owner, acct, "/domains/example.org")
+ page := mainOf(t, body)
+ for label, got := range map[string]string{"card": card, "page": page} {
+ for _, want := range []string{moving, cardLink, domainMoveCopy.SeeMove, status} {
+ if !strings.Contains(got, want) {
+ t.Errorf("owner's %s lacks %q:\n%s", label, want, got)
+ }
+ }
+ for _, b := range []string{"/transfer\"", domainMoveCopy.Move, domainsPageCopy.Buying, domainsPageCopy.Elsewhere, domainsPageCopy.FollowPurchase} {
+ if strings.Contains(got, b) {
+ t.Errorf("owner's %s shows %q:\n%s", label, b, got)
+ }
+ }
+ }
+
+ member := adMember(t, fx, acct)
+ for _, path := range []string{"/domains", "/domains/example.org"} {
+ _, body := adGet(t, fx, member, acct, path)
+ main := mainOf(t, body)
+ if !strings.Contains(main, moving) || strings.Contains(main, "/purchases/") || strings.Contains(main, domainMoveCopy.Move) {
+ t.Errorf("member's %s: want Moving here, no card link, no move:\n%s", path, main)
+ }
+ }
+}
diff --git a/internal/console/domainpoint.go b/internal/console/domainpoint.go
index e55a5c9ec..cd350b156 100644
--- a/internal/console/domainpoint.go
+++ b/internal/console/domainpoint.go
@@ -114,7 +114,9 @@ func normalizePointDomain(domain string) string {
// pointBoughtDomain points acct's registered domain at app:
//
// 1. domain must be one of the account's registrations, else the neutral
-// not-found refusal, and must have no purchase still in flight.
+// not-found refusal; must have a zone here (a transferred domain's DNS
+// is hosted elsewhere: refused before any write, its addresses attach
+// on the app); and must have no purchase still in flight.
// Terminal purchase states never become live again and a registered
// domain cannot be bought twice, so this needs no lock shared with the
// purchase pass.
@@ -139,11 +141,16 @@ func (s *Server) pointBoughtDomain(ctx context.Context, acct *Account, app, doma
log.Printf("console: point %s/%s %s: registration: %v", acct.Sqid, app, domain, err)
return false, pointUnavailable()
}
- if reg == nil || reg.ZoneID == "" {
- // A transferred domain has no zone here (its DNS is hosted
- // elsewhere), so there is nothing to point: the attach door is its way.
+ if reg == nil {
return false, &doorRefusal{Status: http.StatusNotFound}
}
+ if reg.ZoneID == "" {
+ // A transferred domain has no zone here (its DNS is hosted
+ // elsewhere), so there is nothing to point: the attach door is its
+ // way. The registration is the caller's own account's, so saying so
+ // leaks nothing.
+ return false, &doorRefusal{Status: http.StatusUnprocessableEntity, Msg: domainDNSElsewhereCopy.PointRefused}
+ }
live, err := s.ownLiveDomainPurchase(ctx, acct.ID, domain)
if err != nil {
log.Printf("console: point %s/%s %s: purchases: %v", acct.Sqid, app, domain, err)
diff --git a/internal/console/domainpoint_test.go b/internal/console/domainpoint_test.go
index 951c89896..ff91c44ec 100644
--- a/internal/console/domainpoint_test.go
+++ b/internal/console/domainpoint_test.go
@@ -9,6 +9,7 @@ import (
"context"
"encoding/json"
"errors"
+ "html"
"io"
"net"
"net/http"
@@ -627,3 +628,27 @@ func TestPointPendingProofSaysWaiting(t *testing.T) {
}
f.wantClaimedBy(t, p.Domain, "kass")
}
+
+// TestPointRefusesDomainWithoutZone: a transferred domain (ZoneID "") has
+// its DNS hosted elsewhere, so Point refuses it before any write: no zone
+// call, no claim, and the refusal says to attach its addresses instead.
+func TestPointRefusesDomainWithoutZone(t *testing.T) {
+ f := newPurchaseFixture(t)
+ if err := f.st.AddDomainRegistration(DomainRegistration{Domain: pointOwnerDomain, AccountID: f.acct.ID, RegistrarID: "reg-shop",
+ ZoneID: "", Expires: time.Now().AddDate(1, 0, 0), Registrant: purchaseContact()}); err != nil {
+ t.Fatal(err)
+ }
+ _, ref := f.srv.pointBoughtDomain(context.Background(), f.acct, "kass", pointOwnerDomain, pointOwner(f))
+ if ref == nil || ref.Status != http.StatusUnprocessableEntity || ref.Msg != domainDNSElsewhereCopy.PointRefused {
+ t.Fatalf("refusal: %+v", ref)
+ }
+ c, csrf := f.ownerBrowser(t)
+ status, _, body := postForm(t, c, f.appURL("kass", "/domains/point"), url.Values{"csrf": {csrf}, "domain": {pointOwnerDomain}})
+ if status != http.StatusUnprocessableEntity || !strings.Contains(body, html.EscapeString(domainDNSElsewhereCopy.PointRefused)) {
+ t.Fatalf("door = %d:\n%s", status, body)
+ }
+ if len(f.zone.Calls) != 0 {
+ t.Fatalf("zone calls (no SetManaged on a domain without a zone): %v", f.zone.Calls)
+ }
+ f.assertNoClaims(t, pointOwnerDomain)
+}
diff --git a/internal/console/domaintransfer_test.go b/internal/console/domaintransfer_test.go
index 0df638a35..af5a7185e 100644
--- a/internal/console/domaintransfer_test.go
+++ b/internal/console/domaintransfer_test.go
@@ -907,14 +907,15 @@ func TestAlertOperatorReportsDeliveryFailure(t *testing.T) {
}
}
-// A transferred domain has no zone, so the point door does not offer it:
-// nothing is written to a zone with no ID.
+// A transferred domain has no zone, so the point door refuses it (its DNS
+// is hosted elsewhere; TestPointRefusesDomainWithoutZone has the door's
+// whole answer): nothing is written to a zone with no ID.
func TestPointRefusesTransferredDomain(t *testing.T) {
tf := newTransferFixture(t)
if err := tf.st.AddDomainRegistration(DomainRegistration{Domain: "shop.com", AccountID: tf.acct.ID, RegistrarID: "reg-shop", ZoneID: ""}); err != nil {
t.Fatal(err)
}
- if _, ref := tf.srv.pointBoughtDomain(context.Background(), tf.acct, "kass", "shop.com", "buyer@example.test"); ref == nil || ref.Status != http.StatusNotFound {
+ if _, ref := tf.srv.pointBoughtDomain(context.Background(), tf.acct, "kass", "shop.com", "buyer@example.test"); ref == nil || ref.Status != http.StatusUnprocessableEntity {
t.Fatalf("point of a transferred domain: %+v", ref)
}
if len(tf.zone.Zones) != 0 {
diff --git a/internal/console/templates/account_domain.html b/internal/console/templates/account_domain.html
index 2d711cfea..65dd8ccc9 100644
--- a/internal/console/templates/account_domain.html
+++ b/internal/console/templates/account_domain.html
@@ -1,19 +1,19 @@
{{define "account_domain"}}{{template "top" .}}
{{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}}
{{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}}
-{{$c := .DomainsCopy}}{{$v := .DomainPage}}{{$d := $v.Card}}
+{{$c := .DomainsCopy}}{{$e := .DNSElsewhereCopy}}{{$m := .DomainMoveCopy}}{{$v := .DomainPage}}{{$d := $v.Card}}
<div class="pagehead">
<p class="eyebrow">{{$v.Eyebrow}}</p>
<h1>{{$d.Domain}}</h1>
</div>
-<p class="chips">{{if $d.Bought}}<span class="chip chip-canary">{{$c.BoughtHere}}</span>{{else if $d.Buying}}<span class="chip chip-canary">{{$c.Buying}}</span>{{else}}<span class="chip chip-env">{{$c.Elsewhere}}</span>{{end}}{{if and $d.Unpointed (not $d.Buying)}}<span class="chip chip-env">{{$c.NotPointed}}</span>{{end}}</p>
-{{if $d.Buying}}<p class="small">{{$d.PurchaseStatus}}{{with $d.PurchaseHref}} <a href="{{.}}">{{$c.FollowPurchase}}</a>{{end}}</p>{{end}}
+<p class="chips">{{if $d.Bought}}<span class="chip chip-canary">{{$c.BoughtHere}}</span>{{if $d.DNSElsewhere}}<span class="chip chip-env">{{$e.Chip}}</span>{{end}}{{else if $d.Moving}}<span class="chip chip-canary">{{$m.Moving}}</span>{{else if $d.Buying}}<span class="chip chip-canary">{{$c.Buying}}</span>{{else}}<span class="chip chip-env">{{$c.Elsewhere}}</span>{{end}}{{if and $d.Unpointed (not $d.Buying)}}<span class="chip chip-env">{{$c.NotPointed}}</span>{{end}}</p>
+{{if $d.Buying}}<p class="small">{{$d.PurchaseStatus}}{{with $d.PurchaseHref}} <a href="{{.}}">{{if $d.Moving}}{{$m.SeeMove}}{{else}}{{$c.FollowPurchase}}{{end}}</a>{{end}}</p>{{end}}
{{template "domain_tiles" $v.Tiles}}
-{{if $d.Addresses}}
+{{if or $d.Addresses $v.AddAddressHref}}
<h2>{{$c.Addresses}}</h2>
-<div class="tablewrap">
+{{if $d.Addresses}}<div class="tablewrap">
<ul class="envvars addr-rows">
{{range $d.Addresses}}{{if .DetachAction}}<li><details class="envvar"><summary><code class="envvar-name">{{.Host}}</code>{{template "domain_address_value" .}}<span class="envvar-edit"><span class="envvar-when-closed">{{$c.Detach}}</span><span class="envvar-when-open">{{$c.Close}}</span></span></summary>
<form class="envvar-panel settings-row" method="post" action="{{.DetachAction}}">
@@ -25,7 +25,8 @@
</form>
</details></li>{{else}}<li><div class="envvar-row"><code class="envvar-name">{{.Host}}</code>{{template "domain_address_value" .}}</div></li>{{end}}{{end}}
</ul>
-</div>
+</div>{{end}}
+{{with $v.AddAddressHref}}<p class="small"><a href="{{.}}">{{$e.AddAddress}}</a></p>{{end}}
{{if $v.MoveHint}}<p class="small">{{$c.MoveHint}}</p>{{end}}
{{end}}
@@ -53,6 +54,11 @@
<p class="small">{{$c.DNSManaged}}</p>
{{end}}
+{{if and $v.DNSElsewhereLine (not (or $v.Records $v.Guidance))}}
+<h2>{{$c.DNS}}</h2>
+<p class="small">{{$v.DNSElsewhereLine}}</p>
+{{end}}
+
{{if or $v.Records $v.Guidance}}
<h2>{{$c.RecordsToSet}}</h2>
<p class="small">{{$v.RecordsNote}}</p>
@@ -70,4 +76,12 @@
{{end}}
{{range $v.Guidance}}<p class="small">{{.}}</p>{{end}}
{{end}}
+
+{{with $d.MoveHref}}
+<div class="sectionhead">
+ <h2>{{$m.Title}}</h2>
+ <div class="listctl"><a class="btn btn-sm btn-secondary" href="{{.}}">{{$m.Move}}</a></div>
+</div>
+<p class="small">{{$m.Note}}</p>
+{{end}}
{{template "bottom" .}}{{end}}
diff --git a/internal/console/templates/account_domains.html b/internal/console/templates/account_domains.html
index 5046996e2..a3a3edc1f 100644
--- a/internal/console/templates/account_domains.html
+++ b/internal/console/templates/account_domains.html
@@ -11,7 +11,7 @@
{{define "account_domains"}}{{template "top" .}}
{{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}}
{{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}}
-{{$c := .DomainsCopy}}{{$v := .AccountDomains}}
+{{$c := .DomainsCopy}}{{$e := .DNSElsewhereCopy}}{{$m := .DomainMoveCopy}}{{$v := .AccountDomains}}
<div class="pagehead">
<p class="eyebrow">{{$v.Eyebrow}}</p>
<h1>{{$c.Title}}</h1>
@@ -25,14 +25,15 @@
{{with $v.BuyHref}}<div class="listctl"><a class="btn btn-sm" href="{{.}}">{{$c.Buy}}</a></div>{{end}}
</div>
-{{range $v.Cards}}
+{{range $v.Cards}}{{$card := .}}
<section class="tablewrap" aria-label="{{.Domain}}">
<div class="envvar-row domain-head"><a class="envvar-name" href="{{.Href}}">{{.Domain}}</a>
- {{if .Bought}}<span class="chip chip-canary">{{$c.BoughtHere}}</span>{{else if .Buying}}<span class="chip chip-canary">{{$c.Buying}}</span>{{else}}<span class="chip chip-env">{{$c.Elsewhere}}</span>{{end}}
+ {{if .Bought}}<span class="chip chip-canary">{{$c.BoughtHere}}</span>{{if .DNSElsewhere}}<span class="chip chip-env">{{$e.Chip}}</span>{{end}}{{else if .Moving}}<span class="chip chip-canary">{{$m.Moving}}</span>{{else if .Buying}}<span class="chip chip-canary">{{$c.Buying}}</span>{{else}}<span class="chip chip-env">{{$c.Elsewhere}}</span>{{end}}
{{if .Bought}}<span class="envvar-value small">{{$c.ExpiresLine}} <time datetime="{{.ExpiresISO}}">{{.ExpiresText}}</time>{{with .Price}} · {{$c.NextYearLine}} {{.}}{{end}}</span>{{end}}
+ {{with .MoveHref}}<span class="envvar-value small"><a href="{{.}}">{{$m.Move}}</a></span>{{end}}
</div>
<ul class="envvars outcomes">
- {{if .Buying}}<li><div class="envvar-row"><span class="envvar-name small">{{.PurchaseStatus}}</span>{{with .PurchaseHref}}<span class="envvar-value"><a href="{{.}}">{{$c.FollowPurchase}}</a></span>{{end}}</div></li>{{end}}
+ {{if .Buying}}<li><div class="envvar-row"><span class="envvar-name small">{{.PurchaseStatus}}</span>{{with .PurchaseHref}}<span class="envvar-value"><a href="{{.}}">{{if $card.Moving}}{{$m.SeeMove}}{{else}}{{$c.FollowPurchase}}{{end}}</a></span>{{end}}</div></li>{{end}}
{{range .Addresses}}<li><div class="envvar-row"><code class="envvar-name">{{.Host}}</code>{{template "domain_address_value" .}}</div></li>{{end}}
{{if and .Unpointed (not .Buying)}}<li><div class="envvar-row"><span class="envvar-name small">{{$c.NotPointed}}</span>{{with .PointHref}}<span class="envvar-value"><a class="btn btn-sm btn-secondary" href="{{.}}">{{$c.PointAtApp}}</a></span>{{end}}</div></li>{{end}}
</ul>