source: accountserver/src/main/webapp/index.jsp@ 196

Last change on this file since 196 was 95, checked in by wouter, 5 years ago

rename loggedin to welcome

File size: 1.6 KB
RevLine 
[67]1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
[61]2<html>
[65]3<head>
[67]4<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
5<meta content="utf-8" http-equiv="encoding">
[65]6<title>User Log in</title>
7</head>
[61]8<body>
[65]9 <center>
10 <fieldset style="width: 300px">
11 <legend> Login here </legend>
12 <table>
13 <tr>
14 <td>User name (required)</td>
[70]15 <td><input type="text" id="name" name="username"
16 required="required" /></td>
[65]17 </tr>
18 <tr>
19 <td>Password</td>
[70]20 <td><input type="password" id="password" name="userpass"
21 required="required" /></td>
[65]22 </tr>
23 <tr>
24 <td><button onClick="login()">Log in</button></td>
25 </tr>
26 </table>
27 </fieldset>
28 <br> <br>
29 <table>
30 <tr>
[71]31 <td><a href="register.jsp">Register as new user<//a></td>
[65]32 </tr>
33 <tr>
[71]34 <td><a href="reset.jsp">I forgot my password<//a></td>
[65]35 </tr>
36 </table>
37 </center>
38
39 <script>
40 "use strict";
41
42 function login() {
43 var xmlHttp = new XMLHttpRequest();
[85]44 xmlHttp.open("POST", "Accounts", true);
[65]45 xmlHttp.setRequestHeader('Content-Type', "text/json");
46 xmlHttp.onreadystatechange = function() {
47 if (xmlHttp.readyState == 4) {
48 if (xmlHttp.status == 200) {
[95]49 window.location.href = "welcome.jsp";
[65]50 } else {
51 alert("access denied!");
52 }
53 }
54 }
55 xmlHttp.send(JSON.stringify({
[69]56 'name' : document.getElementById('name').value,
57 'password' : document.getElementById('password').value
[65]58 }));
59
60 }
61 </script>
62
63 <noscript>Sorry, your browser does not support JavaScript!</noscript>
[61]64</body>
65</html>
Note: See TracBrowser for help on using the repository browser.