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