mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
Working login page and user auth configuration
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Context antiJARLocking="true" path="">
|
||||
|
||||
<!-- Hostname and port of guacamole proxy -->
|
||||
<Parameter name="guacd-hostname" value="localhost"/>
|
||||
<Parameter name="guacd-port" value="4822"/>
|
||||
|
||||
<!-- Session provider class (provides and configured guacamole session based on authentication information) -->
|
||||
<Parameter name="session-provider" value="net.sourceforge.guacamole.net.BasicGuacamoleSessionProvider"/>
|
||||
|
||||
</Context>
|
@@ -17,9 +17,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
|
||||
|
||||
|
||||
<!-- Basic config -->
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
@@ -29,9 +28,8 @@
|
||||
30
|
||||
</session-timeout>
|
||||
</session-config>
|
||||
|
||||
<!-- Servlets -->
|
||||
|
||||
<!-- Guacamole Tunnel Servlets -->
|
||||
<servlet>
|
||||
<description>Connect servlet.</description>
|
||||
<servlet-name>Connect</servlet-name>
|
||||
@@ -41,7 +39,6 @@
|
||||
<servlet-name>Connect</servlet-name>
|
||||
<url-pattern>/connect</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<description>Outbound servlet.</description>
|
||||
<servlet-name>Outbound</servlet-name>
|
||||
@@ -51,7 +48,6 @@
|
||||
<servlet-name>Outbound</servlet-name>
|
||||
<url-pattern>/outbound</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<description>Input servlet.</description>
|
||||
<servlet-name>Inbound</servlet-name>
|
||||
@@ -61,5 +57,15 @@
|
||||
<servlet-name>Inbound</servlet-name>
|
||||
<url-pattern>/inbound</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- Basic Login Servlets -->
|
||||
<servlet>
|
||||
<servlet-name>BasicLogin</servlet-name>
|
||||
<servlet-class>net.sourceforge.guacamole.basic.BasicLogin</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>BasicLogin</servlet-name>
|
||||
<url-pattern>/login</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
</web-app>
|
||||
|
@@ -34,6 +34,13 @@ div#login-ui {
|
||||
display: table;
|
||||
}
|
||||
|
||||
p#login-error {
|
||||
text-align: center;
|
||||
background: #FDD;
|
||||
color: red;
|
||||
margin: 0.2em;
|
||||
}
|
||||
|
||||
div#login-logo {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
@@ -71,19 +78,18 @@ div#login-dialog h1 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0em;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid silver;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
div#login-dialog #buttons {
|
||||
border-top: 1px solid silver;
|
||||
padding-top: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div#login-dialog #login-fields {
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
border-top: 1px solid silver;
|
||||
border-bottom: 1px solid silver;
|
||||
padding-top: 0.5em;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
div.errorDialogOuter {
|
||||
|
@@ -40,6 +40,9 @@
|
||||
<div id="login-dialog">
|
||||
|
||||
<h1>Guacamole Login</h1>
|
||||
|
||||
<p id="login-error"></p>
|
||||
|
||||
<form id="login-form" action="#">
|
||||
<table id="login-fields">
|
||||
<tr>
|
||||
@@ -124,10 +127,33 @@
|
||||
|
||||
loginForm.onsubmit = function() {
|
||||
|
||||
// FIXME: Do ACTUAL login here
|
||||
var username = document.getElementById("username");
|
||||
var password = document.getElementById("password");
|
||||
|
||||
loginUI.style.display = "none";
|
||||
startGuacamole();
|
||||
var data =
|
||||
"username=" + encodeURIComponent(username.value)
|
||||
+ "&password=" + encodeURIComponent(password.value)
|
||||
|
||||
var xmlhttprequest = new XMLHttpRequest();
|
||||
xmlhttprequest.open("POST", "login", false);
|
||||
xmlhttprequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttprequest.setRequestHeader("Content-length", data.length);
|
||||
xmlhttprequest.send(data);
|
||||
|
||||
if (xmlhttprequest.status == 200) {
|
||||
loginUI.style.display = "none";
|
||||
startGuacamole();
|
||||
}
|
||||
else {
|
||||
|
||||
var loginError = document.getElementById("login-error");
|
||||
|
||||
// Display error, reset and refocus password field
|
||||
loginError.textContent = "Invalid login. Please try again.";
|
||||
password.value = "";
|
||||
password.focus();
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
|
Reference in New Issue
Block a user