Skip to content

Commit f28e91a

Browse files
committed
consoles: Pass onSecurityFailure handler to VncConsole
It is not optional and VncConsole will crash otherwise when there is a authentication failure. Authentication failures should not happen since we pass the correct credentials to VncConsole. However, manually setting a empty password in the machine XML can trigger a authentication failure, and we should be prepared for everything, of course.
1 parent dcdf498 commit f28e91a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/components/vm/consoles/vnc.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class Vnc extends React.Component {
6161
this.connect = this.connect.bind(this);
6262
this.onDisconnected = this.onDisconnected.bind(this);
6363
this.onInitFailed = this.onInitFailed.bind(this);
64+
this.onSecurityFailure = this.onSecurityFailure.bind(this);
6465
this.onExtraKeysDropdownToggle = this.onExtraKeysDropdownToggle.bind(this);
6566
}
6667

@@ -112,6 +113,10 @@ class Vnc extends React.Component {
112113
console.error('VncConsole failed to init: ', detail, this);
113114
}
114115

116+
onSecurityFailure(event) {
117+
console.info('Security failure:', event?.detail?.reason || "unknown reason");
118+
}
119+
115120
onExtraKeysDropdownToggle() {
116121
this.setState({ isActionOpen: false });
117122
}
@@ -182,6 +187,7 @@ class Vnc extends React.Component {
182187
vncLogging={ window.debugging?.includes("vnc") ? 'debug' : 'warn' }
183188
onDisconnected={this.onDisconnected}
184189
onInitFailed={this.onInitFailed}
190+
onSecurityFailure={this.onSecurityFailure}
185191
additionalButtons={additionalButtons}
186192
textConnecting={_("Connecting")}
187193
textDisconnected={_("Disconnected")}

0 commit comments

Comments
 (0)