diff --git a/client/src/Pages/Settings/index.jsx b/client/src/Pages/Settings/index.jsx index 01e46248a..f8f1d109b 100644 --- a/client/src/Pages/Settings/index.jsx +++ b/client/src/Pages/Settings/index.jsx @@ -112,6 +112,18 @@ const Settings = () => { }) ); + // Don't send empty sensitive fields when the key is already set and + // hasn't been explicitly reset — otherwise the backend $unsets them + if (isApiKeySet && !apiKeyHasBeenReset && !toSubmit.pagespeedApiKey) { + delete toSubmit.pagespeedApiKey; + } + if (isGlobalpingKeySet && !globalpingKeyHasBeenReset && !toSubmit.globalpingApiKey) { + delete toSubmit.globalpingApiKey; + } + if (isEmailPasswordSet && !emailPasswordHasBeenReset && !toSubmit.systemEmailPassword) { + delete toSubmit.systemEmailPassword; + } + saveSettings(toSubmit); };