-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreset.html
More file actions
92 lines (75 loc) · 2.66 KB
/
reset.html
File metadata and controls
92 lines (75 loc) · 2.66 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>LeanCloud</title>
<link href="https://lc-avoscloud.cn-n1.lcfile.com/statics/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h3>重置密码</h3>
<hr>
<form class="form-horizontal form login-form" name="resetform" >
<!-- <legend>重置密码</legend> -->
<div class="alert" style="display:none" id="error">
<button type="button" class="close" data-dismiss="alert">×</button>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="inputEmail" >新密码</label>
<div class="col-sm-4">
<input type="password" id="inputEmail" class="form-control" placeholder="新密码" name="password" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="inputPassword" >重新输入</label>
<div class="col-sm-4">
<input type="password" id="inputPassword" class="form-control" placeholder="新密码" name="password1" required>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-4">
<button type="button" class="btn btn-default" id="reset">重置</button>
</div>
</div>
</form>
</div><!--end container-->
<script src="https://lc-avoscloud.cn-n1.lcfile.com/statics/jquery.min.js"></script>
<script src="https://lc-avoscloud.cn-n1.lcfile.com/statics/jquery.jsonp.js"></script>
<script type="text/javascript">
//获得token
var token = location.search.match(/token=(\w*)/);
if(token&&token[1]){
token = token[1];
}
$(function(){
$("#reset").click(function(){
var p = $("[name=password]");
var p1 = $("[name=password1]");
if(p.val()!=p1.val()){
$("#error").show();
$("#error").text("两次输入不一致");//密码输入不一致提示
}
if(p.val()&&p1.val()&&p.val()==p1.val()){
$.jsonp({
url:"/1/resetPassword/"+token,//如果页面运行在自己的服务器,需要写定一个绝对 URL,类似 "https://api.leancloud.cn/1.1/resetPassword/"
data:{"password":p.val()},
callbackParameter: "callback",
cache: false,
success:function(result){
$("#error").show();//成功和失败都会有提示信息, 共用 #error
if(result.error){
$("#error").text(result.error);
}else{
$("#error").text("密码重置成功");
}
},
error:function(result,text){
$("#error").text("服务器发生错误");
}
});
}
});
});
</script>
</body>
</html>