Browse Source

Hide the form when connecting

No need to show the form when connecting to a ssh server
if form arguments are passed via url
pull/83/head
Sheng 5 years ago
parent
commit
4e51d2c3ab
  1. 16
      webssh/static/js/main.js
  2. 5
      webssh/templates/index.html

16
webssh/static/js/main.js

@ -38,6 +38,8 @@ var wssh = {};
jQuery(function($){
var status = $('#status'),
btn = $('.btn-primary'),
form_container = $('.form-container'),
waiter = $('#waiter'),
style = {},
default_title = 'WebSSH',
title_element = document.querySelector('title'),
@ -314,6 +316,15 @@ jQuery(function($){
if (fill_form && validated_form_data) {
restore_items(fields.concat(['password']), validated_form_data);
validated_form_data = undefined;
}
if (waiter.css('display') !== 'none') {
waiter.hide();
}
if (form_container.css('display') === 'none') {
form_container.show();
}
}
@ -692,6 +703,9 @@ jQuery(function($){
data._origin = event_origin;
}
status.text('');
btn.prop('disabled', true);
$.ajax({
url: url,
type: 'post',
@ -802,9 +816,11 @@ jQuery(function($){
log_status('Password via url must be encoded in base64.');
} else {
if (get_object_length(url_form_data)) {
waiter.show();
connect(url_form_data);
} else {
restore_items(fields);
form_container.show();
}
}

5
webssh/templates/index.html

@ -27,7 +27,9 @@
</style>
</head>
<body>
<div class="container">
<div id="waiter" style="display: none"> Connecting ... </div>
<div class="container form-container" style="display: none">
<form id="connect" action="" method="post" enctype="multipart/form-data"{% if debug %} novalidate{% end %}>
<div class="row">
<div class="col">
@ -71,7 +73,6 @@
<button type="submit" class="btn btn-primary">Connect</button>
<button type="reset" class="btn btn-danger">Reset</button>
</form>
</div>
<div class="container">

Loading…
Cancel
Save