···308308 }
309309 emailAdded = true
310310311311+ // step 4: auto-claim <username>.<pds-domain> for this user.
312312+ // All signups through this flow receive a <username>.tngl.sh handle
313313+ // (or whatever the configured PDS host is), so we claim the matching
314314+ // pages subdomain on their behalf. This is the only way to obtain a
315315+ // *.tngl.sh pages domain; it cannot be claimed manually via settings.
316316+ pdsDomain := strings.TrimPrefix(s.config.Pds.Host, "https://")
317317+ pdsDomain = strings.TrimPrefix(pdsDomain, "http://")
318318+ autoClaimDomain := username + "." + pdsDomain
319319+ if err := db.ClaimDomain(s.db, did, autoClaimDomain); err != nil {
320320+ s.l.Warn("failed to auto-claim pages domain at signup",
321321+ "domain", autoClaimDomain,
322322+ "did", did,
323323+ "error", err,
324324+ )
325325+ } else {
326326+ s.l.Info("auto-claimed pages domain at signup", "domain", autoClaimDomain, "did", did)
327327+ }
328328+311329 // if we get here, we've successfully created the account and added the email
312330 success = true
313331