Skip to content

Commit

Permalink
backend: send email on password reset
Browse files Browse the repository at this point in the history
  • Loading branch information
NickSavage committed Dec 20, 2024
1 parent 07fb2cc commit 3b3c6a9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions go-backend/handlers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ func (s *Handler) ResetPasswordRoute(w http.ResponseWriter, r *http.Request) {
return
}

// Send confirmation email
messageBody := fmt.Sprintf("Your password has been successfully reset. If you did not request this change, please contact [email protected] immediately.")
err = s.Server.Mail.SendEmail("Password Reset Confirmation", user.Email, messageBody)
if err != nil {
// Log the error but don't return it to the user since the password was successfully reset
log.Printf("Error sending password reset confirmation email: %v", err)
}

response := models.ResetPasswordResponse{
Message: "Your password has been updated",
}
Expand Down

0 comments on commit 3b3c6a9

Please sign in to comment.