Add trust center front

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-07-28 17:24:16 +02:00
parent 2ac8f31492
commit cb3d79502d
72 changed files with 18712 additions and 82 deletions

View File

@@ -123,6 +123,19 @@ var (
[1] %s
`
trustCenterAccessEmailSubject = "Trust Center Access Invitation - %s"
trustCenterAccessEmailTemplate = `
You have been granted access to %s's Trust Center!
Click the link below to access it:
[1] %s
This link will expire in 7 days.
If the link above doesn't work, copy and paste the entire URL into your browser.
`
)
func (e ErrInvalidCredentials) Error() string {
@@ -909,3 +922,25 @@ func (s Service) ResetPassword(ctx context.Context, tokenString string, newPassw
},
)
}
func (s Service) SendTrustCenterAccessEmail(
ctx context.Context,
name string,
email string,
companyName string,
accessURL string,
) error {
accessEmail := coredata.NewEmail(
name,
email,
fmt.Sprintf(trustCenterAccessEmailSubject, companyName),
fmt.Sprintf(trustCenterAccessEmailTemplate, companyName, accessURL),
)
return s.pg.WithTx(ctx, func(tx pg.Conn) error {
if err := accessEmail.Insert(ctx, tx); err != nil {
return fmt.Errorf("cannot insert access email: %w", err)
}
return nil
})
}