-
Notifications
You must be signed in to change notification settings - Fork 0
/
reset-password.html
128 lines (123 loc) · 5.6 KB
/
reset-password.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
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
<!doctype html>
<!--
* Tabler - Premium and Open Source dashboard template with responsive and high quality UI.
* @version 1.0.0-beta19
* @link https://tabler.io
* Copyright 2018-2023 The Tabler Authors
* Copyright 2018-2023 codecalm.net Paweł Kuna
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE)
-->
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>忘记密码</title>
<!-- CSS files -->
<link href="dist/css/tabler.min.css?1684106062" rel="stylesheet"/>
<link href="dist/css/tabler-flags.min.css?1684106062" rel="stylesheet"/>
<link href="dist/css/tabler-payments.min.css?1684106062" rel="stylesheet"/>
<link href="dist/css/tabler-vendors.min.css?1684106062" rel="stylesheet"/>
<link href="dist/css/demo.min.css?1684106062" rel="stylesheet"/>
<style>
@import url('https://rsms.me/inter/inter.css');
:root {
--tblr-font-sans-serif: 'Inter Var', -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif;
}
body {
font-feature-settings: "cv03", "cv04", "cv11";
}
</style>
</head>
<body class=" d-flex flex-column">
<script src="dist/js/demo-theme.min.js?1684106062"></script>
<div class="page page-center">
<div class="container container-tight py-4">
<div class="text-center mb-4">
<a href="src" class="navbar-brand navbar-brand-autodark"><img src="../static/logo.svg" height="36" alt=""></a>
</div>
<form class="card card-md" action="http://localhost:8080/check-email" method="post" autocomplete="off" novalidate>
<div class="card-body">
<h2 class="card-title text-center mb-4">忘记密码</h2>
<p class="text-muted mb-4">您正在为<label id="remail"></label>重置密码!</p>
<div class="mb-3">
<label class="form-label">设置新密码</label>
<input type="password" class="form-control" id="fpassword" placeholder="请输入新密码"><br>
<input type="password" class="form-control" id="fpassword1" placeholder="请重复新密码"><br>
<input type="text" class="form-control" id="fyanzhengma" placeholder="请输入验证码"><br>
</div>
<div class="form-footer">
<a href="#" class="btn btn-primary w-100" id="fsubmit">
<!-- Download SVG icon from http://tabler-icons.io/i/mail -->
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z" /><path d="M3 7l9 6l9 -6" /></svg>
确认
</a>
</div>
</div>
</form>
<div class="text-center text-muted mt-3">
我记起了,我要回到 <a href="sign-in00.html">登录页面</a> 。
</div>
</div>
</div>
<!-- Libs JS -->
<!-- Tabler Core -->
<script src="dist/js/tabler.min.js?1684106062" defer></script>
<script src="dist/js/demo.min.js?1684106062" defer></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script>
$(document).ready(function () {
// 获取URL中的参数
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const userEmail = urlParams.get('userEmail');
if (userEmail === null) {
alert("请勿直接访问");
} else {
$("#remail").text(userEmail);
// 向后端请求验证码
$.ajax({
url: 'http://localhost:8080/getyanzhengma',
type: 'GET',
contentType: 'application/json',
data: { userEmail: userEmail },
success: function (response) {
console.log('验证码已发送到邮箱: ', userEmail);
},
error: function (xhr, status, error) {
alert('验证码请求失败,请重试。');
}
});
}
$('#fsubmit').click(function (event) {
var password = $("#fpassword").val();
var password1 = $("#fpassword1").val();
var yanzhengma = $("#fyanzhengma").val();
event.preventDefault();
$.ajax({
url: 'http://localhost:8080/resetpassword',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
passWord: password,
passWord1: password1,
yanzhengma: yanzhengma,
userEmail: userEmail
}),
success: function (response) {
if (response.status === "success") {
alert('密码重置成功');
window.location.href = './sign-in.html';
} else {
alert('验证码错误或其他错误,请重试。');
}
},
error: function (xhr, status, error) {
alert('请求失败,请重试。');
}
});
});
});
</script>
</body>
</html>