| 655 | } |
| 656 | |
| 657 | func (a *API) sendIdentityUnlinkedNotification(r *http.Request, tx *storage.Connection, u *models.User, provider string) error { |
| 658 | err := a.sendEmail(r, tx, u, sendEmailParams{ |
| 659 | emailActionType: mail.IdentityUnlinkedNotification, |
| 660 | provider: provider, |
| 661 | }) |
| 662 | if err != nil { |
| 663 | if errors.Is(err, EmailRateLimitExceeded) { |
| 664 | return apierrors.NewTooManyRequestsError(apierrors.ErrorCodeOverEmailSendRateLimit, "%s", EmailRateLimitExceeded.Error()) |
| 665 | } else if herr, ok := err.(*HTTPError); ok { |
| 666 | return herr |
| 667 | } |
| 668 | return apierrors.NewInternalServerError("Error sending identity unlinked notification email").WithInternalError(err) |
| 669 | } |
| 670 | |
| 671 | return nil |
| 672 | } |
| 673 | |
| 674 | func (a *API) sendMFAFactorEnrolledNotification(r *http.Request, tx *storage.Connection, u *models.User, factorType string) error { |
| 675 | err := a.sendEmail(r, tx, u, sendEmailParams{ |