Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(frontend): do not change the password if we don't need to (#1608)

Liu Jib060d6a6d534
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vue
index 6540fa9995..d9b97586d9 100644
--- a/frontend/src/components/InstanceForm.vue
+++ b/frontend/src/components/InstanceForm.vue
@@ -540,8 +540,20 @@ const updateInstanceDataSource = () => {
const newValue = {
...state.instance.dataSourceList[index],
username: curr.username,
- password: curr.useEmptyPassword ? "" : curr.updatedPassword,
};
+
+ if (curr.useEmptyPassword) {
+ // When 'Password: Empty' is checked, we set the password to empty string.
+ newValue.password = "";
+ } else if (curr.updatedPassword) {
+ // When the user has typed something in the password textbox, we use the typed value.
+ newValue.password = curr.updatedPassword;
+ } else {
+ // When the user didn't touch the password textbox, or the user did typed something
+ // but cleared the textbox again, we won't update the password.
+ delete newValue.password;
+ }
+
if (curr.updateSsl) {
newValue.sslCa = curr.sslCa;
newValue.sslKey = curr.sslKey;