Monorepo for Tangled

appview/signup: auto-claim pds handle domain at signup

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>

anirudh.fi 9ca4c866 2403d3f9

verified
+18
+18
appview/signup/signup.go
··· 308 308 } 309 309 emailAdded = true 310 310 311 + // step 4: auto-claim <username>.<pds-domain> for this user. 312 + // All signups through this flow receive a <username>.tngl.sh handle 313 + // (or whatever the configured PDS host is), so we claim the matching 314 + // pages subdomain on their behalf. This is the only way to obtain a 315 + // *.tngl.sh pages domain; it cannot be claimed manually via settings. 316 + pdsDomain := strings.TrimPrefix(s.config.Pds.Host, "https://") 317 + pdsDomain = strings.TrimPrefix(pdsDomain, "http://") 318 + autoClaimDomain := username + "." + pdsDomain 319 + if err := db.ClaimDomain(s.db, did, autoClaimDomain); err != nil { 320 + s.l.Warn("failed to auto-claim pages domain at signup", 321 + "domain", autoClaimDomain, 322 + "did", did, 323 + "error", err, 324 + ) 325 + } else { 326 + s.l.Info("auto-claimed pages domain at signup", "domain", autoClaimDomain, "did", did) 327 + } 328 + 311 329 // if we get here, we've successfully created the account and added the email 312 330 success = true 313 331