diff options
author | Cédric Bosdonnat <cbosdonnat@suse.com> | 2019-02-14 10:44:52 +0100 |
---|---|---|
committer | Jeremy White <jwhite@codeweavers.com> | 2019-02-14 12:46:09 -0600 |
commit | dfa40a73ffde1567a1a215863ff2e9bf0a5d3c6d (patch) | |
tree | 425e7e22d284a7ec351fbda940f9362390d30ae6 | |
parent | df374203dd606faa19c005565432c9028e3106e1 (diff) |
Prompt password in spice_auto.html
In case the user didn't provide any password, we want to prompt him for
it. Try once and if we get an permission denied error, then ask the
password and retry to connect.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
-rw-r--r-- | spice_auto.html | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spice_auto.html b/spice_auto.html index 71c6556..b841499 100644 --- a/spice_auto.html +++ b/spice_auto.html @@ -69,11 +69,15 @@ function spice_error(e) { disconnect(); + if (e !== undefined && e.message === "Permission denied.") { + var pass = prompt("Password"); + connect(pass); + } } - function connect() + function connect(password) { - var host, port, password, scheme = "ws://", uri; + var host, port, scheme = "ws://", uri; // By default, use the host and port of server that served this file host = spice_query_var('host', window.location.hostname); @@ -102,7 +106,9 @@ spice_set_cookie('token', token, 1) } - password = spice_query_var('password', ''); + if (password === undefined) { + password = spice_query_var('password', ''); + } var path = spice_query_var('path', 'websockify'); if ((!host) || (!port)) { @@ -184,7 +190,7 @@ }); */ - connect(); + connect(undefined); </script> </head> |