-
Notifications
You must be signed in to change notification settings - Fork 144
/
Copy pathresetPasswordTemplate.html
100 lines (92 loc) · 3.84 KB
/
resetPasswordTemplate.html
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
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{{host_name}} - Reset Password</title>
<link rel="stylesheet" href="script/semantic/semantic.css">
<link rel="stylesheet" href="script/ao.css">
<script type="application/javascript" src="script/jquery.min.js"></script>
<script type="application/javascript" src="script/semantic/semantic.js"></script>
<style>
</style>
</head>
<body>
<br><br><br>
<div class="ui container" align="center">
<div class="ui basic segment" style="max-width:400px;" align="left">
<div class="imageRight" align="center">
<img class="ui small image" src="data:image/png;base64, {{vendor_logo}}"></img>
</div>
<div class="ui divider"></div>
<div class="ui text container">
<p>Reset your account password on {{host_name}}</p>
</div>
<div class="ui divider"></div>
<form class="ui form" onsubmit="handleFormSubmit(event, this);">
<div class="disabled field">
<label>Username</label>
<input type="text" name="username" value="{{username}}" readonly=true>
</div>
<div class="disabled field">
<label>Password Reset Key</label>
<input type="text" name="rkey" value="{{rkey}}" readonly=true>
</div>
<div class="ui divider"></div>
<div class="field">
<label>New Password</label>
<input id="npw" type="password" name="newpw" placeholder="New Password">
</div>
<div class="field">
<label>Confirm New Password</label>
<input id="cpw" type="password" name="confirmnewpw" placeholder="Confirm New Password">
</div>
<button id="submitbtn" class="ui green button" type="submit">Reset</button>
</form>
<div id="errmsg" class="ui red inverted segment" style="display:none;">
<i class="remove icon"></i> <span id="errtext">Internal Server Error</span>
</div>
<br>
<p>Back to <a href="../index.html">Login</a></p>
</div>
</div>
<script>
var username = "{{username}}";
var resetPasswordKey = "{{rkey}}";
function handleFormSubmit(evt,obj){
evt.preventDefault();
var newpw = obj.newpw.value;
var cpw = obj.confirmnewpw.value;
$("#npw").parent().removeClass("error");
$("#cpw").parent().removeClass("error");
if (newpw != cpw){
showErrorMessage("Confirm password does not match.")
$("#cpw").parent().addClass("error");
return
}
if (newpw == "" || cpw == ""){
showErrorMessage("Password cannot be empty")
$("#npw").parent().addClass("error");
}
//Should be OK now. Submit the form for reset password
$.ajax({
url: "system/reset/confirmPasswordReset",
method: "POST",
data: {username: username, rkey: resetPasswordKey, pw: newpw},
success: function(data){
if (data.error !== undefined){
showErrorMessage(data.error);
}else{
//OK
window.location.href = "index.html";
}
}
})
}
function showErrorMessage(msg){
$("#errtext").text(msg);
$("#errmsg").stop().finish().slideDown("fast");
}
</script>
</body>
</html>