Browse Source

auto update script executed

Toby Chui 1 year ago
parent
commit
476b0188bc
1 changed files with 13 additions and 11 deletions
  1. 13 11
      web/tools/sshconn.html

+ 13 - 11
web/tools/sshconn.html

@@ -122,14 +122,16 @@
                     // Display an error message if either input is invalid
                     const errorLabel = $('<div>').addClass('ui red basic label');
                     if (!validServer) {
-                    errorLabel.text('Invalid server name or IP address');
-                    $('input[name="server"]').addClass('error');
-                    } else if (!validPort) {
-                    errorLabel.text('Invalid port number');
-                    $('input[name="port"]').addClass('error');
+                        $('input[name="server"]').parent().addClass('error');
+                    } else{
+                        $('input[name="server"]').parent().removeClass('error');
+                    }
+                    
+                    if (!validPort) {
+                        $('input[name="port"]').parent().addClass('error');
+                    }else{
+                        $('input[name="port"]').parent().removeClass('error');
                     }
-                    const field = $('input[name="server"]').closest('.field');
-                    field.append(errorLabel);
                 }
             }
 
@@ -172,11 +174,11 @@
 
 
             function isValidServerNameOrIPAddress(str) {
-                //Do not allow loopback
-                if (str == "localhost" || str == "127.0.0.1"){
-                    return false;
+                //loopback
+                if (str == "localhost"){
+                    return true;
                 }
-                
+
                 // First, check if the string is a valid IP address
                 const ipAddressRegex = /^(\d{1,3}\.){3}\d{1,3}$/;
                 if (ipAddressRegex.test(str)) {