fix: email test now uses saved password when not provided

- Test email button now works without re-entering password
- Backend uses saved password if test request has empty password
- Fixes authentication error when testing email notifications
This commit is contained in:
Pulse Monitor
2025-08-12 09:47:05 +00:00
parent 5282bfef2f
commit c62952e070
+6
View File
@@ -268,6 +268,12 @@ func (h *NotificationHandlers) TestNotification(w http.ResponseWriter, r *http.R
}
} else if req.Method == "email" && req.Config != nil {
// If config is provided, use it for testing (without saving)
// If password is empty, use the saved password
if req.Config.Password == "" {
savedConfig := h.monitor.GetNotificationManager().GetEmailConfig()
req.Config.Password = savedConfig.Password
}
log.Info().
Bool("enabled", req.Config.Enabled).
Str("smtp", req.Config.SMTPHost).