Fix custom domain prefix + cookie
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -63,7 +63,8 @@ export default function VerifyMagicLinkPagePageMutation() {
|
|||||||
description: __("Your have successfully signed in"),
|
description: __("Your have successfully signed in"),
|
||||||
variant: "success",
|
variant: "success",
|
||||||
});
|
});
|
||||||
window.location.href = getPathPrefix();
|
const pathPrefix = getPathPrefix();
|
||||||
|
window.location.href = pathPrefix ? getPathPrefix() : "/";
|
||||||
},
|
},
|
||||||
onError: (err) => {
|
onError: (err) => {
|
||||||
toast({
|
toast({
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type Cookie struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cookie) Set(w http.ResponseWriter, session *coredata.Session) {
|
func (c *Cookie) Set(w http.ResponseWriter, session *coredata.Session) {
|
||||||
securecookie.Set(
|
_ = securecookie.Set(
|
||||||
w,
|
w,
|
||||||
c.sessionCookieConfig(time.Until(session.ExpiredAt)),
|
c.sessionCookieConfig(time.Until(session.ExpiredAt)),
|
||||||
session.ID.String(),
|
session.ID.String(),
|
||||||
@@ -46,7 +46,6 @@ func (c *Cookie) sessionCookieConfig(maxAge time.Duration) securecookie.Config {
|
|||||||
HTTPOnly: c.config.HTTPOnly,
|
HTTPOnly: c.config.HTTPOnly,
|
||||||
SameSite: c.config.SameSite,
|
SameSite: c.config.SameSite,
|
||||||
Path: c.config.Path,
|
Path: c.config.Path,
|
||||||
Domain: c.config.Domain,
|
|
||||||
MaxAge: int(maxAge.Seconds()),
|
MaxAge: int(maxAge.Seconds()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func CompliancePageFromContext(ctx context.Context) *coredata.TrustCenter {
|
func CompliancePageFromContext(ctx context.Context) *coredata.TrustCenter {
|
||||||
trustCenter, _ := ctx.Value(compliancePageKey).(*coredata.TrustCenter)
|
page, _ := ctx.Value(compliancePageKey).(*coredata.TrustCenter)
|
||||||
return trustCenter
|
return page
|
||||||
}
|
}
|
||||||
|
|
||||||
func ComplianceMembershipFromContext(ctx context.Context) *coredata.TrustCenterAccess {
|
func ComplianceMembershipFromContext(ctx context.Context) *coredata.TrustCenterAccess {
|
||||||
|
|||||||
@@ -178,8 +178,7 @@ func (r *mutationResolver) SendMagicLink(ctx context.Context, input types.SendMa
|
|||||||
Email: input.Email,
|
Email: input.Email,
|
||||||
}
|
}
|
||||||
|
|
||||||
if false {
|
if customDomain != nil {
|
||||||
// if customDomain != nil {
|
|
||||||
baseURL, err := baseurl.Parse(fmt.Sprintf("https://%s", customDomain.Domain))
|
baseURL, err := baseurl.Parse(fmt.Sprintf("https://%s", customDomain.Domain))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.logger.ErrorCtx(ctx, "cannot parse custom domain url", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot parse custom domain url", log.Error(err))
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ func (s *Server) TrustCenterHandler() http.Handler {
|
|||||||
r := chi.NewRouter()
|
r := chi.NewRouter()
|
||||||
|
|
||||||
r.Use(compliancepage.NewSNIMiddleware(s.trustService))
|
r.Use(compliancepage.NewSNIMiddleware(s.trustService))
|
||||||
|
r.Use(s.stripTrustPrefix)
|
||||||
r.Use(func(next http.Handler) http.Handler {
|
r.Use(func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload")
|
w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload")
|
||||||
|
|||||||
Reference in New Issue
Block a user