package handler import ( "crypto/subtle" "html/template" "net/http" "os" "strings" "github.com/gin-gonic/gin" "github.com/warmbly/warmbly/internal/app/poollink" "github.com/warmbly/warmbly/internal/errx" "github.com/warmbly/warmbly/internal/models" "github.com/warmbly/warmbly/internal/pkg/crypt" ) // A brokered mailbox sign-in for a linked instance passes through this page on // the cloud's own origin. It names who is asking, and the cookie it sets is // what the provider callback requires, so the sign-in completes only in the // browser where the person read this page and chose to continue. const brokerCookieName = "warmbly_broker" // brokerCookiePath covers the consent page, its continue step and both provider callbacks. const brokerCookiePath = "/addresses/" var brokerConsentPage = template.Must(template.New("broker-consent").Parse(`
Connect a {{.Provider}} mailbox to Warmbly Cloud
The self-hosted Warmbly instance at {{.Host}}{{if .Name}} ({{.Name}}){{end}} asked to connect a mailbox through Warmbly Cloud.
If you continue and sign in, the mailbox is added to the Warmbly Cloud workspace {{if .Workspace}}{{.Workspace}}{{else}}linked to that instance{{end}}, and that instance can send and read mail as it.
Only continue if you started this yourself, from that instance. If someone sent you this link, close this tab.