fix(webconsole): require rdp input password (#22397)

This commit is contained in:
屈轩
2025-04-10 11:23:16 +08:00
committed by GitHub
parent 1fa3e39b4b
commit 2a0ac9d196
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -335,7 +335,7 @@ func handleServerRemoteRDPConsole(ctx context.Context, w http.ResponseWriter, r
httperrors.GeneralServerError(ctx, w, err)
return
}
handleDataSession(ctx, info, w, "rdp", url.Values{"password": {info.GetPassword()}}, true)
handleDataSession(ctx, info, w, "rdp", url.Values{"password": {info.GetPassword()}}, false)
}
func responsePublicCloudConsole(ctx context.Context, info *session.RemoteConsoleInfo, w http.ResponseWriter) {
+3 -3
View File
@@ -69,9 +69,6 @@ func NewRemoteRDPConsoleInfoByCloud(ctx context.Context, s *mcclient.ClientSessi
if err != nil {
return nil, err
}
if !ret.Contains("username") || !ret.Contains("password") {
return nil, httperrors.NewMissingParameterError("username")
}
info.Password, _ = ret.GetString("password")
info.Username, _ = ret.GetString("username")
}
@@ -99,6 +96,9 @@ func (info *RemoteRDPConsoleInfo) Scan(byte, func(string)) {
}
func (info *RemoteRDPConsoleInfo) IsNeedLogin() (bool, error) {
if len(info.Username) == 0 || len(info.Password) == 0 {
return true, nil
}
return false, nil
}