forked from blinx-org/moderator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangepassword.php
162 lines (155 loc) · 5.85 KB
/
changepassword.php
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
include_once './libs/const.php';
$_pageid = 115;
session_start();
$vid=$_SESSION['vid'];
?>
<html lang="en">
<head>
<?php
$_TITLE = "Change Password";
include_once './tags/common/head.php';
?>
<?php include_once './tags/common/scripts.php'; ?>
<?php include_once('./libs/signup.php');?>
</head>
<style type="text/css"></style>
</head>
<script>
function showerrormessage(message) {
$("#message").text(message);
$("#message").show();
};
function validatePassword()
{
var pwd = $("#pwd").val();
var cpwd=$("#cnpwd").val();
var oldpwd=$("#oldpwd").val();
var error = "";
var illegalChars = /[\W_]/; // allow only letters and numbers
var re = /[0-9]/;
var small = /[a-z]/;
var caps = /[A-Z]/;
if(oldpwd=="")
{
error = "Please enter current password.\n";
showerrormessage(error);
return false;
}
else if (pwd == "") {
error = "Please enter new password.\n";
showerrormessage(error);
return false;
}else if (cpwd == "") {
error = "Please enter confirm password.\n";
showerrormessage(error);
return false;
}
else if ((pwd.length < 5) || (pwd.length > 15)) {
error = "Password must contain at least six characters! \n";
showerrormessage(error);
return false;
} else if (!re.test(pwd)) {
error = "password must contain at least one number (0-9)!\n";
showerrormessage(error);
return false;
} else if (!small.test(pwd)) {
error = "password must contain at least one lowercase letter (a-z)!\n";
showerrormessage(error);
return false;
}else if (!caps.test(pwd)) {
error = "password must contain at least one uppercase letter (A-Z)\n";
showerrormessage(error);
return false;
}
else if(oldpwd==pwd)
{
error = "Old password and new password cannot be same.\n";
showerrormessage(error);
return false;
}
else if(cpwd!=pwd)
{
error = "password and confirm password didn't match\n";
showerrormessage(error);
return false;
}
else
{
return true;
}
return true;
};
</script>
<body >
<?php include_once './tags/global_header/header.php'; ?>
<div class="heads" style="background: url(resources/img/bag-banner-1.jpg) center center;">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2><span>//</span> Change Password.</h2>
</div>
</div>
</div>
</div>
<div class='row'>
<div class='col-sm-4 col-md-offset-4'>
<p class="alert-danger" id="message" >
<script>
showerrormessage
(
<?php
if($status!='')
{
if($status[0]['DBStatus']=="0")
{
$sql=$status[0]['Message'];
echo "'".$sql."'";
}
else if($status[0]['DBStatus']=="2")
{
echo "'".$status[0]['Message']."'";
}
else
{
echo '';
}
}
?>
);
</script>
</p>
<form accept-charset="UTF-8" action=""
class="" id="changepassword" method="post" onsubmit="return validatePassword()">
<div class='form-row'>
<div class='col-xs-12 form-group required'>
<label class='control-label'>Current password</label>
<input class='form-control' type="Password" name="oldpwd" id="oldpwd" size='4' type='text'>
</div>
</div>
<div class='form-row'>
<div class='col-xs-12 form-group card required'>
<label class='control-label'>New password</label>
<input autocomplete='off'name="pwd" type="Password" id="pwd" class='form-control card-number' size='20' type='text'>
</div>
</div>
<div class='form-row'>
<div class='col-xs-12 form-group card required'>
<label class='control-label'>Confirm password</label>
<input autocomplete='off' name="cnpwd" type="Password" id="cnpwd" class='form-control' size='20' type='text'>
<input id="action" type="hidden" name="action" value="changepass">
<input id="vid" type="hidden" type="text" name="vid" value="<?php echo $vid ?>">
</div>
</div>
<div class='form-row'>
<div class='col-md-12 form-group'>
<button class='form-control btn btn-primary submit-button' type='submit'>Change password</button>
</div>
</div>
</form>
</div>
</div>
</body>
<?php include_once './tags/global_header/footer.php'; ?>
<!-- end:copyright -->
<?php include_once './tags/common/scripts.php'; ?>