(r *http.Request, tx *storage.Connection, u *models.User)
| 588 | } |
| 589 | |
| 590 | func (a *API) sendPasswordChangedNotification(r *http.Request, tx *storage.Connection, u *models.User) error { |
| 591 | err := a.sendEmail(r, tx, u, sendEmailParams{ |
| 592 | emailActionType: mail.PasswordChangedNotification, |
| 593 | }) |
| 594 | if err != nil { |
| 595 | if errors.Is(err, EmailRateLimitExceeded) { |
| 596 | return apierrors.NewTooManyRequestsError(apierrors.ErrorCodeOverEmailSendRateLimit, "%s", EmailRateLimitExceeded.Error()) |
| 597 | } else if herr, ok := err.(*HTTPError); ok { |
| 598 | return herr |
| 599 | } |
| 600 | return apierrors.NewInternalServerError("Error sending password changed notification email").WithInternalError(err) |
| 601 | } |
| 602 | |
| 603 | return nil |
| 604 | } |
| 605 | |
| 606 | func (a *API) sendEmailChangedNotification(r *http.Request, tx *storage.Connection, u *models.User, oldEmail string) error { |
| 607 | err := a.sendEmail(r, tx, u, sendEmailParams{ |
no test coverage detected