fix: 数据源编辑密码保留 + Redis ACL 认证支持
后端: - UpdateInstance: 空密码和'******'都不更新密码字段,防止编辑后丢失密码 - testRedis/getRedisClient/getRedisMetrics: 增加 Username 参数支持 Redis 6.0+ ACL 认证 - username 为 'default' 或空时走传统密码认证模式 前端: - EditInstanceDialog: Redis 用户名字段提示'6.0+ ACL 可选',密码 placeholder 改为'不修改请留空' - CreateInstanceForm: Redis 类型也显示用户名输入框(可选),创建/测试连接时 Redis username 为空则不传 - Redis 提示文案从'无需用户名'改为'6.0+ ACL 支持用户名+密码认证'
This commit is contained in:
1 parent
bfb64d4dce
commit
8af868b3ca
5 files changed
+59
-34
No files matched your search
@@ -108,15 +108,16 @@ func UpdateInstance(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// if password is masked, don't update it
|
||||
if pw, ok := input["password"].(string); ok && pw == "******" {
|
||||
delete(input, "password")
|
||||
}
|
||||
// Encrypt password if provided and not masked
|
||||
if pw, ok := input["password"].(string); ok && pw != "" {
|
||||
encPw, err := encryptPassword(pw)
|
||||
if err == nil {
|
||||
input["password"] = "enc:" + encPw
|
||||
// if password is empty or masked placeholder, don't update it
|
||||
if pw, ok := input["password"].(string); ok {
|
||||
if pw == "" || pw == "******" {
|
||||
delete(input, "password")
|
||||
} else {
|
||||
// Encrypt new password
|
||||
encPw, err := encryptPassword(pw)
|
||||
if err == nil {
|
||||
input["password"] = "enc:" + encPw
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user