Line | |
---|
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
---|
5 | <meta content="utf-8" http-equiv="encoding">
|
---|
6 | <title>User Log in</title>
|
---|
7 | </head>
|
---|
8 | <body>
|
---|
9 | <center>
|
---|
10 | <fieldset style="width: 300px">
|
---|
11 | <legend> Reset your Password </legend>
|
---|
12 | <table>
|
---|
13 | <tr>
|
---|
14 | <td>User name</td>
|
---|
15 | <td><input type="text" id="name" name="username" required="required" /></td>
|
---|
16 | </tr>
|
---|
17 | <tr>
|
---|
18 | <td><button onClick="reset()">Reset my Password</button></td>
|
---|
19 | </tr>
|
---|
20 | </table>
|
---|
21 | </fieldset>
|
---|
22 | </center>
|
---|
23 |
|
---|
24 | <script>
|
---|
25 | "use strict";
|
---|
26 |
|
---|
27 |
|
---|
28 | function reset() {
|
---|
29 | var xmlHttp = new XMLHttpRequest();
|
---|
30 | var name = document.getElementById('name').value;
|
---|
31 | xmlHttp.open("DELETE", "Accounts?" + name, true);
|
---|
32 | xmlHttp.setRequestHeader('Content-Type', "text/json");
|
---|
33 | xmlHttp.onreadystatechange = function() {
|
---|
34 | if (xmlHttp.readyState == 4) {
|
---|
35 | if (xmlHttp.status == 200) {
|
---|
36 | alert("A new password has been mailed!");
|
---|
37 | } else {
|
---|
38 | alert("reset denied! This account may have no associated email");
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|
42 | xmlHttp.send(JSON.stringify(document.getElementById('name').value));
|
---|
43 |
|
---|
44 | }
|
---|
45 | </script>
|
---|
46 |
|
---|
47 | <noscript>Sorry, your browser does not support JavaScript!</noscript>
|
---|
48 | </body>
|
---|
49 | </html>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.