commit 4e51d2c3abf4aaa0ea960178b974fec97136eb24
parent a11d5a01e55bfccc6814f0b54bf9fa05605a5f5a
Author: Sheng <webmaster0115@gmail.com>
Date: Fri, 23 Aug 2019 09:55:42 +0800
Hide the form when connecting
No need to show the form when connecting to a ssh server
if form arguments are passed via url
Diffstat:
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/webssh/static/js/main.js b/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();
}
}
diff --git a/webssh/templates/index.html b/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">