console: Replace auth-rejected with auth-error signal

Should be similar here. auth-rejected is hard to trigger anyways

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-08-29 15:56:56 -04:00
parent d5f7089ef2
commit 940bd3873e
2 changed files with 8 additions and 19 deletions

View File

@ -784,9 +784,6 @@ class vmmConsolePages(vmmGObjectUI):
else:
self._enable_modifiers()
def _viewer_auth_rejected(self, ignore, errmsg):
self._activate_unavailable_page(errmsg)
def _viewer_auth_error(self, ignore, errmsg, viewer_will_disconnect):
errmsg = _("Viewer authentication error: %s") % errmsg
self.err.val_err(errmsg)
@ -852,7 +849,6 @@ class vmmConsolePages(vmmGObjectUI):
self._viewer.connect("connected", self._viewer_connected)
self._viewer.connect("disconnected", self._viewer_disconnected)
self._viewer.connect("auth-error", self._viewer_auth_error)
self._viewer.connect("auth-rejected", self._viewer_auth_rejected)
self._viewer.connect("need-auth", self._viewer_need_auth)
self._viewer.connect("agent-connected", self._viewer_agent_connected)
self._viewer.connect("usb-redirect-error",

View File

@ -45,7 +45,6 @@ class Viewer(vmmGObject):
"connected": (vmmGObject.RUN_FIRST, None, []),
"disconnected": (vmmGObject.RUN_FIRST, None, [str, str]),
"auth-error": (vmmGObject.RUN_FIRST, None, [str, bool]),
"auth-rejected": (vmmGObject.RUN_FIRST, None, [str]),
"need-auth": (vmmGObject.RUN_FIRST, None, [bool, bool]),
"agent-connected": (vmmGObject.RUN_FIRST, None, []),
"usb-redirect-error": (vmmGObject.RUN_FIRST, None, [str]),
@ -338,19 +337,6 @@ class VNCViewer(Viewer):
for idx in range(int(credList.n_values)):
values.append(credList.get_nth(idx))
for cred in values:
if cred in [GtkVnc.DisplayCredential.PASSWORD,
GtkVnc.DisplayCredential.USERNAME,
GtkVnc.DisplayCredential.CLIENTNAME]:
continue
errmsg = (_("Unable to provide requested credentials to the VNC "
"server.\n The credential type %s is not supported") %
str(cred.value_name))
self.emit("auth-rejected", errmsg)
return
withUsername = False
withPassword = False
for cred in values:
@ -359,8 +345,15 @@ class VNCViewer(Viewer):
withPassword = True
elif cred == GtkVnc.DisplayCredential.USERNAME:
withUsername = True
elif cred == GtkVnc.DisplayCredential.CLIENTNAME:
elif cred == GtkVnc.DisplayCredential.CLIENTNAME: # pragma: no cover
self._display.set_credential(cred, "libvirt-vnc")
else: # pragma: no cover
errmsg = (
_("Unable to provide requested credentials to the VNC server.\n"
"The credential type %s is not supported") %
str(cred.value_name))
self.emit("auth-error", errmsg, True)
return
if withUsername or withPassword:
self.emit("need-auth", withPassword, withUsername)