Files
guacamole-client/guacamole/src/main/webapp/index.xhtml
2011-08-11 09:57:25 -07:00

163 lines
5.3 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<!--
Guacamole - Clientless Remote Desktop
Copyright (C) 2010 Michael Jumper
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="icon" type="image/png" href="images/guacamole-logo-64.png"/>
<link rel="stylesheet" type="text/css" href="styles/login.css"/>
<title>Guacamole ${project.version}</title>
</head>
<body>
<div id="login-ui" style="display: none">
<div id="login-dialog-middle">
<div id="login-dialog">
<p id="login-error"></p>
<form id="login-form" action="#" method="post">
<div id="login-fields">
<table>
<tr>
<th>Username</th>
<td><input type="text" name="username" id="username" autofocus="autofocus"/></td>
</tr>
<tr>
<th>Password</th>
<td><input type="password" name="password" id="password"/></td>
</tr>
</table>
<img class="logo" src="images/guacamole-logo-64.png" alt=""/>
</div>
<div id="buttons">
<input type="submit" name="login" id="login" value="Login"/>
</div>
</form>
</div>
</div>
</div>
<!-- Connection list UI -->
<div id="connection-list-ui" style="display: none">
<h1>
<img class="logo" src="images/guacamole-logo-64.png" alt=""/>
Available Connections
</h1>
<table class="connections">
<thead>
<tr>
<th>Name</th>
<th>Protocol</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>zhz@localhost</td>
<td>vnc</td>
<td class="description">Connect to test.guac-dev.org via vnc.</td>
</tr>
<tr>
<td>zhz@localhost</td>
<td>ssh</td>
<td class="description">Connect to test.guac-dev.org via ssh.</td>
</tr>
</tbody>
</table>
</div>
<div id="version-dialog">
Guacamole ${project.version}
</div>
<!-- Init -->
<script type="text/javascript"> /* <![CDATA[ */
var loginForm = document.getElementById("login-form");
var loginUI = document.getElementById("login-ui");
var connectionListUI = document.getElementById("connection-list-ui");
// TODO: Get connection list
// On no-auth fail, show login UI
loginForm.onsubmit = function() {
var username = document.getElementById("username");
var password = document.getElementById("password");
var data =
"username=" + encodeURIComponent(username.value)
+ "&password=" + encodeURIComponent(password.value)
try {
// Log in
var xhr = new XMLHttpRequest();
xhr.open("POST", "login", false);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(data);
// Handle failures
if (xhr.status != 200)
throw new Error("Invalid login");
// Hide login UI, display connections
loginUI.style.display = "none";
connectionListUI.style.display = "";
}
catch (e) {
var loginError = document.getElementById("login-error");
// Display error, reset and refocus password field
loginError.textContent = e.message;
password.value = "";
password.focus();
return false;
}
// On success, hide loginUI, get and show connection list.
return false;
}
loginUI.style.display = "";
/* ]]> */ </script>
</body>
</html>