webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit b3c33ff6bd76f4f5df40cc1fe9a138cf0cecd08c
parent b372fcbbb276d112aa74534d97273b4061429f39
Author: Sheng <webmaster0115@gmail.com>
Date:   Wed, 12 Sep 2018 13:47:33 +0800

Use form attribute novalidate for debug mode

Diffstat:
Mtests/test_app.py | 2+-
Mwebssh/static/js/main.js | 10+++++-----
Mwebssh/templates/index.html | 8++++----
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/test_app.py b/tests/test_app.py @@ -482,7 +482,7 @@ class TestAppInDebug(OtherTestBase): def test_html(self): response = self.fetch('/', method='GET') - self.assertNotIn(b'required>', response.body) + self.assertIn(b'novalidate>', response.body) class TestAppMiscell(OtherTestBase): diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js @@ -1,16 +1,16 @@ +/*jslint browser:true */ + var jQuery; var wssh = {}; jQuery(function($){ - /*jslint browser:true */ - var status = $('#status'), btn = $('.btn-primary'), style = {}, title_text = 'WebSSH', title_element = document.querySelector('title'), - debug = !document.querySelector('#hostname').required, + debug = document.querySelector('#connect').noValidate, DISCONNECTED = 0, CONNECTING = 1, CONNECTED = 2, @@ -472,8 +472,8 @@ jQuery(function($){ wssh.connect = connect; $(form_id).submit(function(event){ - event.preventDefault(); - connect(); + event.preventDefault(); + connect(); }); }); diff --git a/webssh/templates/index.html b/webssh/templates/index.html @@ -24,21 +24,21 @@ </head> <body> <div class="container"> - <form id="connect" action="" method="post" enctype="multipart/form-data"> + <form id="connect" action="" method="post" enctype="multipart/form-data"{% if debug %} novalidate{% end %}> <div class="row"> <div class="col"> <label for="Hostname">Hostname</label> - <input class="form-control" type="text" id="hostname" name="hostname" value="" {% if not debug %}required{% end %}> + <input class="form-control" type="text" id="hostname" name="hostname" value="" required> </div> <div class="col"> <label for="Port">Port</label> - <input class="form-control" type="number" id="port" name="port" value="" {% if not debug %}min=1 max=65535 required{% end %}> + <input class="form-control" type="number" id="port" name="port" value="" min=1 max=65535 required> </div> </div> <div class="row"> <div class="col"> <label for="Username">Username</label> - <input class="form-control" type="text" id="username" name="username" value="" {% if not debug %}required{% end %}> + <input class="form-control" type="text" id="username" name="username" value="" required> </div> <div class="col"> <label for="Username">Private Key</label>