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"),
|
||||
variant: "success",
|
||||
});
|
||||
window.location.href = getPathPrefix();
|
||||
const pathPrefix = getPathPrefix();
|
||||
window.location.href = pathPrefix ? getPathPrefix() : "/";
|
||||
},
|
||||
onError: (err) => {
|
||||
toast({
|
||||
|
||||
@@ -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()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user