Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions internal/mailer/templatemailer/templatemailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,16 @@ func (m *Mailer) GetEmailActionLink(user *models.User, actionType, referrerURL s

func (m *Mailer) PasswordChangedNotificationMail(r *http.Request, user *models.User) error {
data := map[string]any{
"Email": user.Email,
"Data": user.UserMetaData,
"SiteURL": m.cfg.SiteURL,
"Email": user.Email,
"Data": user.UserMetaData,
}
return m.mail(r.Context(), m.cfg, PasswordChangedNotificationTemplate, user.GetEmail(), data)
}

func (m *Mailer) EmailChangedNotificationMail(r *http.Request, user *models.User, oldEmail string) error {
data := map[string]any{
"SiteURL": m.cfg.SiteURL,
"Email": user.GetEmail(), // the new email address that has been set on the account
"OldEmail": oldEmail, // the old email address that was on the account before the change
"Data": user.UserMetaData,
Expand All @@ -442,6 +444,7 @@ func (m *Mailer) EmailChangedNotificationMail(r *http.Request, user *models.User

func (m *Mailer) PhoneChangedNotificationMail(r *http.Request, user *models.User, oldPhone string) error {
data := map[string]any{
"SiteURL": m.cfg.SiteURL,
"Email": user.GetEmail(),
"Phone": user.GetPhone(), // the new phone number that has been set on the account
"OldPhone": oldPhone, // the old phone number that was on the account before the change
Expand All @@ -452,6 +455,7 @@ func (m *Mailer) PhoneChangedNotificationMail(r *http.Request, user *models.User

func (m *Mailer) IdentityLinkedNotificationMail(r *http.Request, user *models.User, provider string) error {
data := map[string]any{
"SiteURL": m.cfg.SiteURL,
"Email": user.GetEmail(),
"Provider": provider, // the provider of the newly linked identity
"Data": user.UserMetaData,
Expand All @@ -461,6 +465,7 @@ func (m *Mailer) IdentityLinkedNotificationMail(r *http.Request, user *models.Us

func (m *Mailer) IdentityUnlinkedNotificationMail(r *http.Request, user *models.User, provider string) error {
data := map[string]any{
"SiteURL": m.cfg.SiteURL,
"Email": user.GetEmail(),
"Provider": provider, // the provider of the unlinked identity
"Data": user.UserMetaData,
Expand All @@ -470,6 +475,7 @@ func (m *Mailer) IdentityUnlinkedNotificationMail(r *http.Request, user *models.

func (m *Mailer) MFAFactorEnrolledNotificationMail(r *http.Request, user *models.User, factorType string) error {
data := map[string]any{
"SiteURL": m.cfg.SiteURL,
"Email": user.GetEmail(),
"FactorType": factorType,
"Data": user.UserMetaData,
Expand All @@ -479,6 +485,7 @@ func (m *Mailer) MFAFactorEnrolledNotificationMail(r *http.Request, user *models

func (m *Mailer) MFAFactorUnenrolledNotificationMail(r *http.Request, user *models.User, factorType string) error {
data := map[string]any{
"SiteURL": m.cfg.SiteURL,
"Email": user.GetEmail(),
"FactorType": factorType,
"Data": user.UserMetaData,
Expand Down