Refacto trust center access

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-08-05 09:35:32 +02:00
parent 60c4b945c7
commit 0b21afa2d0
2 changed files with 41 additions and 48 deletions

View File

@@ -123,19 +123,6 @@ 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 {
@@ -922,25 +909,3 @@ 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
})
}