| 621 | } |
| 622 | |
| 623 | func (a *API) sendPhoneChangedNotification(r *http.Request, tx *storage.Connection, u *models.User, oldPhone string) error { |
| 624 | err := a.sendEmail(r, tx, u, sendEmailParams{ |
| 625 | emailActionType: mail.PhoneChangedNotification, |
| 626 | oldPhone: oldPhone, |
| 627 | }) |
| 628 | if err != nil { |
| 629 | if errors.Is(err, EmailRateLimitExceeded) { |
| 630 | return apierrors.NewTooManyRequestsError(apierrors.ErrorCodeOverEmailSendRateLimit, "%s", EmailRateLimitExceeded.Error()) |
| 631 | } else if herr, ok := err.(*HTTPError); ok { |
| 632 | return herr |
| 633 | } |
| 634 | return apierrors.NewInternalServerError("Error sending phone changed notification email").WithInternalError(err) |
| 635 | } |
| 636 | |
| 637 | return nil |
| 638 | } |
| 639 | |
| 640 | func (a *API) sendIdentityLinkedNotification(r *http.Request, tx *storage.Connection, u *models.User, provider string) error { |
| 641 | err := a.sendEmail(r, tx, u, sendEmailParams{ |