-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathpassword_reset_action.php
78 lines (41 loc) · 1 KB
/
password_reset_action.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
<?php
include("code/includes.php");
$error = false;
if( isset($_REQUEST['username']) ) {
$this_user = new User();
$this_user->getAttr($_REQUEST['username'], "username");
if( md5($this_user->password) == $_REQUEST['password_hash'] ) {
if( $_REQUEST['password'] == $_REQUEST['password_2'] ) {
$this_user->password = md5($_REQUEST['password']);
$this_user->update();
} else {
$error = true;
$error_message = "Your passwords don't match. Please go back and fix this.";
}
} else {
$error = true;
$error_message = "Account not found.";
}
}
?>
<html>
<head>
<title>Password Reset</title>
<?php include("parts/includes.php"); ?>
</head>
<body>
<?php include("parts/header.php");
include("parts/login_sidebar.php"); ?>
<div class="mainContainer">
<h2>Password Reset</h2>
<?php
if( $error ) { ?>
<p><?=$error_message?></p>
<?php } else { ?>
<p>Your password has been changed. Please log in above.</p>
<?php }
?>
</div>
<?php include("parts/footer.php"); ?>
</body>
</html>