This repository has been archived by the owner on Dec 7, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
edit_profile_pw.php
111 lines (107 loc) · 4.24 KB
/
edit_profile_pw.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
<?php
require_once 'autoload.php';
$User = new User();
$User->__init();
$User->read(User::getSessionUserID());
if (valAllNotnull()) {
$User->setLastUpdateDate();
$iscorrect = array(
"OldPassword" => (bool) $User->isCorrectPassword($_POST["OldPassword"]),
"RePassword" => (bool) $_POST["Password"] === $_POST["RePassword"],
"Password" => (bool) $User->setPassword($_POST["Password"]),
);
if (Validation::valAll($iscorrect) && $User->update()) {
$Passed = true;
}
}
//=========================================validate=========================================
function valAllNotnull() {
return
isset($_POST["submit"]) &&
isset($_POST["Password"]) &&
isset($_POST["RePassword"]) &&
isset($_POST["OldPassword"]);
}
?><!DOCTYPE html>
<html lang="en">
<head>
<title>ACU Times | Change PW</title>
<?php require_once("header.php"); ?>
<script src="js/Validate.js"></script>
</head>
<body>
<?php include ("navbar.php"); ?>
<!-------------------------------------------------------------------------- content -------------------------------------------------------------------------->
<div class="container">
<h3>
<ul class="nav nav-pills">
<li role="presentation"><a href="profile.php">Profile</a></li>
<li role="presentation"><a href="edit_profile.php">Change personal info</a></li>
<li role="presentation" class="active"><a>Change Password</a></li>
</ul>
</h3>
<br><br><br>
<?php
if (@$Passed)
echo '<div class="alert alert-info alert-dismissable"> <a class="panel-close close" data-dismiss="alert">×</a> <i class="fa fa-check"></i> Password updated succsesfuly </div>'
?>
<form role="form" action="edit_profile_pw.php" method="post" onSubmit="return isAllValid()">
<!-- #################################################################### Old Password #################################################################### -->
<div class="form-group">
<label class="control-label" for="OldPassword">Old password :</label>
<div class="controls">
<input type="password"
name="OldPassword"
id="OldPassword"
value=""
class="form-control"
maxlength="32"
required>
<span class="help-block"><ul>
<?php PrintHTML::validation("OldPassword", @$iscorrect["OldPassword"], "Password Don't Match") ?>
</ul></span>
</div>
</div>
<!-- #################################################################### Password #################################################################### -->
<div class="form-group">
<label class="control-label" for="Password">New password :</label>
<div class="controls">
<input type="password"
name="Password"
id="Password"
value=""
class="form-control"
onBlur="valPassword(this)"
maxlength="32"
required>
<span class="help-block"><ul>
<?php PrintHTML::validation("Password", @$iscorrect["Password"], "Must contain a number (0-9) ,upercase letter (A-Z) & lowercase letter (a-z)") ?>
</ul></span>
</div>
</div>
<!-- #################################################################### RePassword #################################################################### -->
<div class="form-group">
<label class="control-label" for="RePassword">Reenter password :</label>
<div class="controls">
<input type="password"
name="RePassword"
id="RePassword"
value=""
class="form-control"
onBlur="valRePassword(this, Password)"
maxlength="32"
required>
<span class="help-block"><ul>
<?php PrintHTML::validation("RePassword", @$iscorrect["RePassword"], "Password does not match") ?>
</ul></span>
</div>
</div>
<!-- #################################################################### Submit #################################################################### -->
<button type="submit" class="btn btn-primary pull-right">Change Password</button>
</div>
<!-- #################################################################### #################################################################### -->
</form>
</div>
<?php include ("footer.php"); ?>
</body>
</html>