-
Notifications
You must be signed in to change notification settings - Fork 0
/
change-password.php
65 lines (55 loc) · 1.72 KB
/
change-password.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
<?php
require_once "importance.php";
if (!User::loggedIn()) {
Config::redir("login.php");
}
?>
<html>
<head>
<title><?php echo CONFIG::SYSTEM_NAME; ?> : Change Password</title>
<?php require_once "inc/head.inc.php"; ?>
</head>
<body>
<?php require_once "inc/header.inc.php"; ?>
<div class='container-fluid'>
<div class='row'>
<div class='col-md-3'><?php require_once "inc/sidebar.inc.php"; ?></div> <!-- this should be a sidebar -->
<div class='col-md-8'>
<div class='content-area'>
<div class='content-header'>
Password
</div>
<?php require_once "inc/alerts.inc.php"; ?>
<div class='content-body'>
<div class='form-holder'>
<?php
if (isset($_POST['o-p'])) {
$oldPassword = $_POST['o-p'];
$newPassword = $_POST['n-p'];
$confirmPassword = $_POST['c-p'];
if (strlen($newPassword) < 5) {
Messages::error("New password must be 5 characters");
} else if ($oldPassword == "" || $newPassword == "") {
Messages::error("All fields must be field");
} else if ($newPassword != $confirmPassword) {
Messages::error("Oops! Your password did not match");
} else {
User::changePassword($oldPassword, $newPassword);
}
}
$form = new Form(2, "post");
$form->init();
$form->textBox("Old Password", "o-p", "password", "", "");
$form->textBox("New Password", "n-p", "password", "", "");
$form->textBox("Confirm Password", "c-p", "password", "", "");
$form->close("Change Password");
?>
</div>
</div><!-- end of the content area -->
</div>
</div><!-- col-md-8 -->
</div> <!-- this should be a sidebar -->
</div>
</div>
</body>
</html>