This repository has been archived by the owner on Oct 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reset-password.php
203 lines (159 loc) · 7.57 KB
/
reset-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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?php
require("lib/bootstrap.php");
if ($auth->isLogedIn()) {
if ($utilities->isPost()) {
if (!empty($_POST["current-password"]) && !empty($_POST["new-password1"]) && !empty($_POST["new-password1"])) {
$currentPassword = $utilities->filter($_POST["current-password"]);
$newPassword1 = $utilities->filter($_POST["new-password1"]);
$newPassword2 = $utilities->filter($_POST["new-password2"]);
if($newPassword1 == $newPassword2) {
$passwordCheck = $auth->createHash("md5", $currentPassword, HASH_PASSWORD_KEY);
$user = $users->getUser($session->get("userid"));
if($passwordCheck == $user[0]["password"]){
$newPassword = $auth->createHash("md5", $newPassword1, HASH_PASSWORD_KEY);
$reset = $auth->resetPassword($user[0]["id"], $newPassword);
$notifications->userPasswordReset(array($user[0]["email"]), $newPassword1);
$notice = "Your password has changed successfully";
$utilities->redirect("my-account.php", 3);
} else {
$notice = "Current password is wrong";
}
} else {
$notice = "Password does not match";
}
} else {
$notice = "Enter all required information";
}
}
} else {
// user not loged
$utilities->redirect("error.php?code=12");
}
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php echo APPLICATION_TITLE ?> - Password Reset</title>
<!-- styles -->
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/fonts.css" />
<link rel="stylesheet" href="css/jquery.ui.custom.css" />
<link rel="stylesheet" href="css/jquery.ui.achtung.css" />
<link rel="stylesheet" href="css/jquery.tiptip.css" />
<link rel="stylesheet" href="css/style.css" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="css/ie8.css" />
<![endif]-->
<!--[if lte IE 7]>
<link rel="stylesheet" href="css/ie7.css" />
<![endif]-->
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<!-- scripts -->
<script src="js/jquery.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="js/jquery.ui.custom.js"></script>
<script src="js/jquery.stickypanel.js"></script>
<script src="js/jquery.ui.achtung.js"></script>
<script src="js/jquery.tiptip.js"></script>
<script src="js/script.js"></script>
<!-- remove for production -->
<script src="js/cssrefresh.js"></script>
<!-- javascript -->
<script>
$(document).ready(function() {
<?php
$utilities->notify($notice, 7);
?>
});
</script>
</head>
<body>
<!-- wrap -->
<div id="wrap">
<!-- header -->
<header>
<?php if (defined("SHORTCUTS") && SHORTCUTS) { ?>
<!-- breadcrumbs -->
<div class="breadcrumbs">
<a class="tip" href="home.php" title="Home: Select project"><img src="images/home.png"></a>
<?php
if ($users->isAdmin($session->get("userid"))) {
?>
<a class="separator"><img src="images/separator.png"></a>
<a class="tip" href="all-users.php" title="Users"><img src="images/all-users.png"></a>
<?php } ?>
<a class="tip" href="my-account.php" title="My Account"><img src="images/user.png"></a>
</div>
<!-- /breadcrumbs -->
<?php } ?>
<!-- welcome message -->
<div id="welcome-message">
<p>Welcome to <?php echo APPLICATION_TITLE ?> <span class="orange"><?php echo $session->get("firstname"); ?></span></p>
</div>
<!-- /welcome message -->
<!-- top panel -->
<div id="top-panel">
<!-- settings -->
<div id="settings">
<ul id="settings-menu">
<li><a class="tip" href="my-tasks.php" role="link" title="List my tasks"><img src="images/all-tasks-gray.png">My Tasks</a></li>
<li><a class="tip" href="my-projects.php" role="link" title="List my projects"><img src="images/all-projects-gray.png">My Projects</a></li>
<?php
if ($users->isAdmin($session->get("userid"))) {
?>
<li><a class="tip" href="all-users.php" role="link" title="List all users"><img src="images/all-users-gray.png">Users</a></li>
<?php } ?>
<li><a class="tip" href="my-account.php" role="link" title="My account details"><img src="images/user-gray.png">My Account</a></li>
<li><a class="tip" href="index.php?action=logout" role="link" title="Logout"><img src="images/logout-gray.png">Logout</a></li>
</ul>
<a id="settings-button" class="tip" href="#" role="link" title="Your settings"><img src="images/settings.png"></a>
</div>
<!-- /settings -->
</div>
<!-- /top panel -->
</header>
<!-- /header -->
<!-- main wrapper -->
<section id="main-wrapper" class="no-bg">
<!-- main content -->
<div id="main-content">
<!-- page content -->
<article id="select-project">
<form name="password-reset" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset>
<label class="large-label">Current Password</label>
<input name="current-password" type="password" id="current-password" class="text-input rounded" placeholder="Current Password" required>
</fieldset>
<fieldset class="split-fieldset">
<label class="large-label">New Password</label>
<input name="new-password1" type="password" id="new-password1" class="text-input rounded" placeholder="New Password" required>
<input name="new-password2" type="password" id="new-password2" class="text-input rounded" placeholder="Repeat New Password" required>
</fieldset>
<div class="spacer"></div>
<fieldset>
<a class="orange-button default-button" id="login" role="button" href="#" onClick="document['password-reset'].submit(); return false;" title="Login">RESET</a>
<a class="link-button tip" id="cancel-reset" role="link" href="my-account.php" title="Cancel and return to profile">Cancel</a>
</fieldset>
</form>
</article>
<!-- /page content -->
</div>
<!-- /main content -->
</section>
<!-- /main wrapper -->
<!-- footer -->
<footer>
<!-- logo -->
<div id="logo">
<img class="ng-logo" src="images/logo.png" alt="<?php echo APPLICATION_TITLE ?> logo" />
</div>
<!-- /logo -->
</footer>
<!-- /footer -->
</div>
<!-- /wrap -->
</body>
</html>