Allow submitting the password from the input field

This commit is contained in:
Pierre Ossman 2017-02-03 13:19:15 +01:00
parent 648c83984c
commit 84b05d24b0
3 changed files with 17 additions and 10 deletions

View File

@ -91,7 +91,7 @@ input[type=input], input[type=password], input:not([type]), textarea {
background: linear-gradient(to top, rgb(255, 255, 255) 80%, rgb(240, 240, 240)); background: linear-gradient(to top, rgb(255, 255, 255) 80%, rgb(240, 240, 240));
} }
input[type=button], select { input[type=button], input[type=submit], select {
/* Disable default rendering */ /* Disable default rendering */
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
@ -109,7 +109,7 @@ input[type=button], select {
vertical-align: middle; vertical-align: middle;
} }
input[type=button] { input[type=button], input[type=submit] {
padding-left: 20px; padding-left: 20px;
padding-right: 20px; padding-right: 20px;
} }
@ -121,29 +121,35 @@ option {
input[type=input]:focus, input[type=password]:focus, input[type=input]:focus, input[type=password]:focus,
input:not([type]):focus, input[type=button]:focus, input:not([type]):focus, input[type=button]:focus,
input[type=submit]:focus,
textarea:focus, select:focus { textarea:focus, select:focus {
box-shadow: 0px 0px 3px rgba(74, 144, 217, 0.5); box-shadow: 0px 0px 3px rgba(74, 144, 217, 0.5);
border-color: rgb(74, 144, 217); border-color: rgb(74, 144, 217);
outline: none; outline: none;
} }
input[type=button]::-moz-focus-inner { input[type=button]::-moz-focus-inner,
input[type=submit]::-moz-focus-inner {
border: none; border: none;
} }
input[type=input]:disabled, input[type=password]:disabled, input[type=input]:disabled, input[type=password]:disabled,
input:not([type]):disabled, input[type=button]:disabled, input:not([type]):disabled, input[type=button]:disabled,
input[type=submit]:disabled,
textarea:disabled, select:disabled { textarea:disabled, select:disabled {
color: rgb(128, 128, 128); color: rgb(128, 128, 128);
background: rgb(240, 240, 240); background: rgb(240, 240, 240);
} }
input[type=button]:active, select:active { input[type=button]:active, input[type=submit]:active,
select:active {
border-bottom-width: 1px; border-bottom-width: 1px;
margin-top: 3px; margin-top: 3px;
} }
:root:not(.noVNC_touch) input[type=button]:hover:not(:disabled), :root:not(.noVNC_touch) select:hover:not(:disabled) { :root:not(.noVNC_touch) input[type=button]:hover:not(:disabled),
:root:not(.noVNC_touch) input[type=submit]:hover:not(:disabled),
:root:not(.noVNC_touch) select:hover:not(:disabled) {
background: linear-gradient(to top, rgb(255, 255, 255), rgb(250, 250, 250)); background: linear-gradient(to top, rgb(255, 255, 255), rgb(250, 250, 250));
} }

View File

@ -1152,13 +1152,14 @@ var UI;
UI.showStatus(msg, "warning"); UI.showStatus(msg, "warning");
}, },
setPassword: function() { setPassword: function(e) {
var password = document.getElementById('noVNC_password_input').value; var password = document.getElementById('noVNC_password_input').value;
UI.rfb.sendPassword(password); UI.rfb.sendPassword(password);
UI.reconnect_password = password; UI.reconnect_password = password;
document.getElementById('noVNC_password_dlg') document.getElementById('noVNC_password_dlg')
.classList.remove('noVNC_open'); .classList.remove('noVNC_open');
return false; // Prevent actually submitting the form
e.preventDefault();
}, },
/* ------^------- /* ------^-------

View File

@ -277,17 +277,17 @@
<!-- Password Dialog --> <!-- Password Dialog -->
<div class="noVNC_center noVNC_connect_layer"> <div class="noVNC_center noVNC_connect_layer">
<div id="noVNC_password_dlg" class="noVNC_panel"> <div id="noVNC_password_dlg" class="noVNC_panel"><form>
<ul> <ul>
<li> <li>
<label>Password:</label> <label>Password:</label>
<input id="noVNC_password_input" type="password" /> <input id="noVNC_password_input" type="password" />
</li> </li>
<li> <li>
<input id="noVNC_password_button" type="button" value="Send Password" class="noVNC_submit" /> <input id="noVNC_password_button" type="submit" value="Send Password" class="noVNC_submit" />
</li> </li>
</ul> </ul>
</div> </form></div>
</div> </div>
<!-- Transition Screens --> <!-- Transition Screens -->