Skip to content

Commit

Permalink
fix: add token for non-secure email change
Browse files Browse the repository at this point in the history
  • Loading branch information
J0 committed Sep 4, 2024
1 parent bf276ab commit f988eb4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/api/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,11 @@ func (a *API) sendEmail(r *http.Request, tx *storage.Connection, u *models.User,
}

if config.Hook.SendEmail.Enabled {
// When secure email change is disabled, we place the token for the new email on emailData.Token
if emailActionType == mail.EmailChangeVerification && !config.Mailer.SecureEmailChangeEnabled && u.GetEmail() != "" {
otp = otpNew
}

emailData := mail.EmailData{
Token: otp,
EmailActionType: emailActionType,
Expand Down

0 comments on commit f988eb4

Please sign in to comment.