Add: CreateBackendAccess function
This commit is contained in:
@@ -87,6 +87,37 @@ func (s *EmailService) SendVerificationEmail(user *models.User, token *string) e
|
||||
return s.SendEmail(user.Email, subject, body, "", "")
|
||||
|
||||
}
|
||||
func (s *EmailService) SendGrantBackendAccessEmail(user *models.User, token *string) error {
|
||||
// Prepare data to be injected into the template
|
||||
data := struct {
|
||||
FirstName string
|
||||
LastName string
|
||||
Token string
|
||||
BASEURL string
|
||||
FRONTEND_PATH string
|
||||
UserID uint
|
||||
}{
|
||||
FirstName: user.FirstName,
|
||||
LastName: user.LastName,
|
||||
Token: *token,
|
||||
FRONTEND_PATH: config.Site.FrontendPath,
|
||||
BASEURL: config.Site.BaseURL,
|
||||
UserID: user.ID,
|
||||
}
|
||||
|
||||
subject := constants.MailGrantBackendAccessSubject
|
||||
htmlBody, err := ParseTemplate("mail_grant_backend_access.tmpl", data)
|
||||
if err != nil {
|
||||
logger.Error.Print("Couldn't send grant backend access mail")
|
||||
return err
|
||||
}
|
||||
plainBody, err := ParseTemplate("mail_grant_backend_access.txt.tmpl", data)
|
||||
if err != nil {
|
||||
logger.Error.Print("Couldn't parse password mail")
|
||||
return err
|
||||
}
|
||||
return s.SendEmail(user.Email, subject, htmlBody, plainBody, "")
|
||||
}
|
||||
|
||||
func (s *EmailService) SendChangePasswordEmail(user *models.User, token *string) error {
|
||||
// Prepare data to be injected into the template
|
||||
|
||||
Reference in New Issue
Block a user