package handler import ( "crypto/subtle" "html/template" "net/http" "github.com/gin-gonic/gin" "github.com/warmbly/warmbly/internal/app/mailboxconnect" "github.com/warmbly/warmbly/internal/errx" "github.com/warmbly/warmbly/internal/models" "github.com/warmbly/warmbly/internal/pkg/crypt" "github.com/warmbly/warmbly/internal/pkg/displayname" ) // A sign-in link opens here. The page names the workspace asking, and the // cookie it sets is what the provider callback requires, so the mailbox // connects only in the browser where its owner read this and continued. const connectCookieName = "warmbly_connect" // connectFormTargets are where Continue may redirect: the Google and Microsoft authorize hosts. const connectFormTargets = "https://accounts.google.com https://login.microsoftonline.com" var connectLinkPage = template.Must(template.New("connect-link").Parse(`
Connect your {{.Provider}} mailbox
{{.Workspace}} asked you to connect {{if .Email}}{{.Email}}{{else}}a mailbox{{end}}{{if .App}} through {{.App}}{{end}}.
If you continue and sign in, that workspace can send and read mail as this mailbox, and warm it up.
Only continue if you expected this request. If you do not know who sent you this link, close this tab.