mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-10 17:13:30 +08:00
fix: 解决数据库用户名显示错误的问题 (#2028)
This commit is contained in:
parent
f0e78c4b7c
commit
0eee2d9807
2 changed files with 4 additions and 6 deletions
|
@ -305,19 +305,18 @@ func (r *Local) SyncDB(version string) ([]SyncDBInfo, error) {
|
|||
}
|
||||
}
|
||||
if len(dataItem.Username) == 0 {
|
||||
username := loadNameByDB(parts[0], version)
|
||||
dataItem.Username = loadNameByDB(parts[0], version)
|
||||
if err := r.CreateUser(CreateInfo{
|
||||
Name: parts[0],
|
||||
Format: parts[1],
|
||||
Version: version,
|
||||
Username: username,
|
||||
Username: dataItem.Username,
|
||||
Password: common.RandStr(16),
|
||||
Permission: "%",
|
||||
Timeout: 300,
|
||||
}, false); err != nil {
|
||||
global.LOG.Errorf("sync from remote server failed, err: create user failed %v", err)
|
||||
}
|
||||
dataItem.Username = parts[0]
|
||||
dataItem.Permission = "%"
|
||||
} else {
|
||||
if isLocal {
|
||||
|
|
|
@ -316,19 +316,18 @@ func (r *Remote) SyncDB(version string) ([]SyncDBInfo, error) {
|
|||
i++
|
||||
}
|
||||
if len(dataItem.Username) == 0 {
|
||||
userName := loadNameByDB(dbName, version)
|
||||
dataItem.Username = loadNameByDB(dbName, version)
|
||||
if err := r.CreateUser(CreateInfo{
|
||||
Name: dbName,
|
||||
Format: charsetName,
|
||||
Version: version,
|
||||
Username: userName,
|
||||
Username: dataItem.Username,
|
||||
Password: common.RandStr(16),
|
||||
Permission: "%",
|
||||
Timeout: 300,
|
||||
}, false); err != nil {
|
||||
return datas, fmt.Errorf("sync db from remote server failed, err: create user failed %v", err)
|
||||
}
|
||||
dataItem.Username = dbName
|
||||
dataItem.Permission = "%"
|
||||
} else {
|
||||
if isLocal {
|
||||
|
|
Loading…
Reference in a new issue