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

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

#31 use jsp because then you keep the same session even without cookies. With html, you get new session every time

File size: 1.8 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>
[69]31 <td><a href="register.html">Register as new user<//a></td>
[65]32 </tr>
33 <tr>
[69]34 <td><a href="reset.html">I forgot my password<//a></td>
[65]35 </tr>
36 </table>
[70]37 <a href="loggedin.jsp">go on</a>
[65]38
39 </center>
40
41 <script>
42 "use strict";
43
44 function login() {
45 var xmlHttp = new XMLHttpRequest();
[70]46 xmlHttp.open("POST", "AccountServlet", true);
[65]47 xmlHttp.setRequestHeader('Content-Type', "text/json");
48 xmlHttp.onreadystatechange = function() {
49 if (xmlHttp.readyState == 4) {
50 if (xmlHttp.status == 200) {
[70]51 //window.location.href = "loggedin.html";
52/* var path = window.location.href;
53 var i = path.lastIndexOf("/") + 1;
54 var loc = path.substring(0, i).concat("loggedin.html");
55 window.location.href(loc);
56 */ alert("logged in!");
[65]57 } else {
58 alert("access denied!");
59 }
60 }
61 }
62 xmlHttp.send(JSON.stringify({
[69]63 'name' : document.getElementById('name').value,
64 'password' : document.getElementById('password').value
[65]65 }));
66
67 }
68 </script>
69
70 <noscript>Sorry, your browser does not support JavaScript!</noscript>
[61]71</body>
72</html>
Note: See TracBrowser for help on using the repository browser.