Spaces:
Paused
Paused
BinaryONe
commited on
Commit
·
2e0d7a4
1
Parent(s):
821299e
Changes
Browse files- WebSSH/templates/index.html +31 -15
WebSSH/templates/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
align-items: center;
|
| 16 |
height: 100vh;
|
| 17 |
}
|
| 18 |
-
.
|
| 19 |
background-color: #ffffff;
|
| 20 |
padding: 30px;
|
| 21 |
border-radius: 10px;
|
|
@@ -34,12 +34,13 @@
|
|
| 34 |
</style>
|
| 35 |
</head>
|
| 36 |
<body>
|
| 37 |
-
<div
|
| 38 |
-
<
|
| 39 |
-
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
<div class="form-group">
|
| 44 |
<label for="username">Username:</label>
|
| 45 |
<input type="text" id="username" name="username" class="form-control" required>
|
|
@@ -48,19 +49,33 @@
|
|
| 48 |
<label for="password">Password:</label>
|
| 49 |
<input type="password" id="password" name="password" class="form-control" required>
|
| 50 |
</div>
|
| 51 |
-
<button type="submit" class="btn btn-primary">
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
</div>
|
| 59 |
-
<button type="button" id="execute-button" class="btn btn-success" onclick="run_commands()">Execute</button>
|
| 60 |
-
</div>
|
| 61 |
|
| 62 |
<script>
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
event.preventDefault();
|
| 65 |
var username = document.getElementById('username').value;
|
| 66 |
var password = document.getElementById('password').value;
|
|
@@ -93,5 +108,6 @@
|
|
| 93 |
});
|
| 94 |
});
|
| 95 |
</script>
|
|
|
|
| 96 |
</body>
|
| 97 |
</html>
|
|
|
|
| 15 |
align-items: center;
|
| 16 |
height: 100vh;
|
| 17 |
}
|
| 18 |
+
.container {
|
| 19 |
background-color: #ffffff;
|
| 20 |
padding: 30px;
|
| 21 |
border-radius: 10px;
|
|
|
|
| 34 |
</style>
|
| 35 |
</head>
|
| 36 |
<body>
|
| 37 |
+
<div class="container">
|
| 38 |
+
<div id="error-popup" class="error-popup">
|
| 39 |
+
<i class="fas fa-exclamation-circle"></i> Incorrect password. Please try again.
|
| 40 |
+
</div>
|
| 41 |
|
| 42 |
+
<div class="user-container">
|
| 43 |
+
<h1>Create New User</h1>
|
| 44 |
<div class="form-group">
|
| 45 |
<label for="username">Username:</label>
|
| 46 |
<input type="text" id="username" name="username" class="form-control" required>
|
|
|
|
| 49 |
<label for="password">Password:</label>
|
| 50 |
<input type="password" id="password" name="password" class="form-control" required>
|
| 51 |
</div>
|
| 52 |
+
<button type="submit" class="btn btn-primary" onclick="get_privatekey()">Get Key</button>
|
| 53 |
+
</div>
|
| 54 |
|
| 55 |
+
<div class="command-container">
|
| 56 |
+
<div class="form-group">
|
| 57 |
+
<label for="command">Command:</label>
|
| 58 |
+
<input type="text" id="command" name="command" class="form-control" required>
|
| 59 |
+
</div>
|
| 60 |
+
<button type="button" id="execute-button" class="btn btn-success" onclick="run_commands()">Execute</button>
|
| 61 |
</div>
|
|
|
|
|
|
|
| 62 |
|
| 63 |
<script>
|
| 64 |
+
function run_commands() {
|
| 65 |
+
const command = document.getElementById('command').value;
|
| 66 |
+
fetch('/commands', {
|
| 67 |
+
method: 'POST',
|
| 68 |
+
headers: {
|
| 69 |
+
'Content-Type': 'application/json'
|
| 70 |
+
},
|
| 71 |
+
body: JSON.stringify({ command: command })
|
| 72 |
+
})
|
| 73 |
+
.then(response => response.text())
|
| 74 |
+
.then(data => {
|
| 75 |
+
console.log(data);
|
| 76 |
+
});
|
| 77 |
+
}
|
| 78 |
+
function get_privatekey() {
|
| 79 |
event.preventDefault();
|
| 80 |
var username = document.getElementById('username').value;
|
| 81 |
var password = document.getElementById('password').value;
|
|
|
|
| 108 |
});
|
| 109 |
});
|
| 110 |
</script>
|
| 111 |
+
</div>
|
| 112 |
</body>
|
| 113 |
</html>
|