dabd762d0c23a6af140daf74d79157c8bee5c9e0
[guacamole.git] / src / main / webapp / index.xhtml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html>
3
4 <!--
5     Guacamole - Clientless Remote Desktop
6     Copyright (C) 2010  Michael Jumper
7
8     This program is free software: you can redistribute it and/or modify
9     it under the terms of the GNU Affero General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU Affero General Public License for more details.
17
18     You should have received a copy of the GNU Affero General Public License
19     along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 -->
21
22 <html xmlns="http://www.w3.org/1999/xhtml">
23
24     <head>
25         <link rel="icon" type="image/png" href="images/guacamole-logo-64.png"/>
26         <link rel="stylesheet" type="text/css" href="styles/login.css"/>
27         <title>Guacamole ${project.version}</title>
28     </head>
29
30     <body>
31
32         <div id="login-ui">
33             <div id="login-dialog-middle">
34
35                 <div id="login-dialog">
36
37                     <p id="login-error"></p>
38
39                     <form id="login-form" action="#" method="post">
40
41                         <div id="login-fields">
42                             <table>
43                                 <tr>
44                                     <th>Username</th>
45                                     <td><input type="text" name="username" id="username" autofocus="autofocus"/></td>
46                                 </tr>
47                                 <tr>
48                                     <th>Password</th>
49                                     <td><input type="password" name="password" id="password"/></td>
50                                 </tr>
51                             </table>
52
53                             <img class="logo" src="images/guacamole-logo-64.png" alt=""/>
54                         </div>
55
56                         <div id="buttons">
57                             <input type="submit" name="login" id="login" value="Login"/>
58                         </div>
59
60                     </form>
61                 </div>
62
63                 <div id="version-dialog">
64                     Guacamole ${project.version}
65                 </div>
66
67             </div>
68         </div>
69
70         <!-- Main UI - hidden until login succeeds -->
71         <div id="connection-list-ui" style="display: none">
72             <!-- STUB -->
73         </div>
74
75
76         <!-- Init -->
77         <script type="text/javascript"> /* <![CDATA[ */
78
79             var loginForm = document.getElementById("login-form");
80             var loginUI = document.getElementById("login-ui");
81             var display = document.getElementById("display");
82
83             // TODO: Get connection list
84             // On no-auth fail, show login UI 
85
86             loginForm.onsubmit = function() {
87
88                 var username = document.getElementById("username");
89                 var password = document.getElementById("password");
90
91                 var data =
92                        "username=" + encodeURIComponent(username.value)
93                     + "&password=" + encodeURIComponent(password.value)
94
95                 try {
96                     // STUB
97                 }
98                 catch (e) {
99
100                     var loginError = document.getElementById("login-error");
101
102                     // Display error, reset and refocus password field
103                     loginError.textContent = e.message;
104                     password.value = "";
105                     password.focus();
106
107                     return false;
108
109                 }
110
111                 // On success, hide loginUI, get and show connection list.
112                 return false;
113
114             }
115
116             /* ]]> */ </script>
117
118     </body>
119
120 </html>