Fix custom domain prefix + cookie

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-01-15 18:20:48 +04:00
committed by Bryan Frimin
parent 334ca2c932
commit c5cd225d95
5 changed files with 7 additions and 7 deletions

View File

@@ -63,7 +63,8 @@ export default function VerifyMagicLinkPagePageMutation() {
description: __("Your have successfully signed in"),
variant: "success",
});
window.location.href = getPathPrefix();
const pathPrefix = getPathPrefix();
window.location.href = pathPrefix ? getPathPrefix() : "/";
},
onError: (err) => {
toast({

View File

@@ -27,7 +27,7 @@ type Cookie struct {
}
func (c *Cookie) Set(w http.ResponseWriter, session *coredata.Session) {
securecookie.Set(
_ = securecookie.Set(
w,
c.sessionCookieConfig(time.Until(session.ExpiredAt)),
session.ID.String(),
@@ -46,7 +46,6 @@ func (c *Cookie) sessionCookieConfig(maxAge time.Duration) securecookie.Config {
HTTPOnly: c.config.HTTPOnly,
SameSite: c.config.SameSite,
Path: c.config.Path,
Domain: c.config.Domain,
MaxAge: int(maxAge.Seconds()),
}
}

View File

@@ -28,8 +28,8 @@ var (
)
func CompliancePageFromContext(ctx context.Context) *coredata.TrustCenter {
trustCenter, _ := ctx.Value(compliancePageKey).(*coredata.TrustCenter)
return trustCenter
page, _ := ctx.Value(compliancePageKey).(*coredata.TrustCenter)
return page
}
func ComplianceMembershipFromContext(ctx context.Context) *coredata.TrustCenterAccess {

View File

@@ -178,8 +178,7 @@ func (r *mutationResolver) SendMagicLink(ctx context.Context, input types.SendMa
Email: input.Email,
}
if false {
// if customDomain != nil {
if customDomain != nil {
baseURL, err := baseurl.Parse(fmt.Sprintf("https://%s", customDomain.Domain))
if err != nil {
r.logger.ErrorCtx(ctx, "cannot parse custom domain url", log.Error(err))

View File

@@ -172,6 +172,7 @@ func (s *Server) TrustCenterHandler() http.Handler {
r := chi.NewRouter()
r.Use(compliancepage.NewSNIMiddleware(s.trustService))
r.Use(s.stripTrustPrefix)
r.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload")