Use custom domain in trust center invitation
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -386,10 +386,27 @@ func (s TrustCenterAccessService) sendAccessEmail(ctx context.Context, tx pg.Con
|
|||||||
return fmt.Errorf("cannot load organization: %w", err)
|
return fmt.Errorf("cannot load organization: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hostname := s.svc.hostname
|
||||||
|
path := "/trust/" + trustCenter.Slug + "/access"
|
||||||
|
|
||||||
|
if organization.CustomDomainID != nil {
|
||||||
|
customDomain, err := s.svc.CustomDomains.GetOrganizationCustomDomain(ctx, organization.ID)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot load custom domain: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if customDomain == nil || customDomain.SSLStatus != coredata.CustomDomainSSLStatusActive {
|
||||||
|
return fmt.Errorf("custom domain is not active")
|
||||||
|
}
|
||||||
|
|
||||||
|
hostname = customDomain.Domain
|
||||||
|
path = "/access"
|
||||||
|
}
|
||||||
|
|
||||||
accessURL := url.URL{
|
accessURL := url.URL{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: s.svc.hostname,
|
Host: hostname,
|
||||||
Path: "/trust/" + trustCenter.Slug + "/access",
|
Path: path,
|
||||||
RawQuery: url.Values{
|
RawQuery: url.Values{
|
||||||
"token": []string{accessToken},
|
"token": []string{accessToken},
|
||||||
}.Encode(),
|
}.Encode(),
|
||||||
|
|||||||
Reference in New Issue
Block a user