-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresetPassword.html
More file actions
132 lines (99 loc) · 3.17 KB
/
resetPassword.html
File metadata and controls
132 lines (99 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<body>
<!-- Bootstrap core CSS -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<link href="bootstrap/css/bootstrap-theme.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="theme.css" rel="stylesheet">
<title>Password Reset</title>
</head>
<script>
window.onLoad = load()
function load() {
if (sessionStorage.getItem('username') == null) {
alert("You're not logged in, redirecting to home");
window.location = "./login.html";
}
}
function confirm() {
//get username and password
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
$
.ajax({
url : 'http://shrouded-earth-7234.herokuapp.com/resetPassword.php',
type : 'post',
data : {
"username" : username,
"password" : password
},
success : function(response) {
console.log(response);
if(response.indexOf(password)==-1){
alert("ERROR: could not change password for "+username);
}
else{
alert("changed "+username+"'s password to "+password);
}
}
});
}
function ShowHide() {
if (document.getElementById('toggle').checked) {
document.getElementById('password').type = 'text';
} else {
document.getElementById('password').type = 'password';
}
}
function backToAdminPage() {
window.location = "./adminPage.html";
}
</script>
<button id="back" onclick="backToAdminPage()"
class="btn btn-lg btn-link">Back To Admin Page</button>
<h1 style="margin-left: 4%">Password Change</h1>
<div style="border:1px solid gray;">
<div class="jumbotron" style="padding-bottom:22px">
<form novalidate ng-app name="changePassword">
<table style="width:800px;text-align:left;">
<tbody>
<tr>
<td>
<label for="username">Username</label>
<input type="text" id="username">
</td>
</tr>
<tr>
<td>
<label for="password">Password</label>
<input type="password" id="password">
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="toggle" value="off" onchange="ShowHide();" style="width:30px; margin-left: 165px"/>Show Password
</td>
</tr>
</tbody>
</table>
<div style="margin-left:155px; width:500px; margin-top:22px">
<input type="button" class="btn btn-success" id="submit" value="Submit" onclick="confirm()" style="width:100px">
</div>
</div>
</div>
<script type="text/javascript" src="jquery-2.1.1.min.js"></script>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="bootsrap/js/bootstrap.min.js"></script>
<script src="bootstrap/js/docs.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="bootstrap/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>