blob: ac28b4e2209ef4985f7b2ae643d29b2918fa43b8 (
plain)
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
|
<?php
/* Foursquare Community Site
*
* Copyright (C) 2011 Foursquare Church.
*
* Developers: Jesse Morgan <jmorgan@foursquarestaff.com>
*
*/
require_once('../src/base.inc.php');
$error = '';
// Handle form?
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$user = $_SESSION['currentUser'];
// Change password
if (isset($_POST['oldpassword']) and trim($_POST['oldpassword']) != ""
and isset($_POST['newpassword']) and trim($_POST['newpassword']) != ""
and isset($_POST['newpassword2']) and trim($_POST['newpassword2']) != "") {
if ($user->authenticate($_POST['oldpassword'])) {
if ($_POST['newpassword'] == $_POST['newpassword2']) {
$user->setPassword($_POST['newpassword']);
} else {
$error .= '<p>Passwords do not match.</p>';
}
} else {
$error .= '<p>"Old Password" does not match your current password.</p>';
}
}
// Set Notify
$notify = isset($_POST['notify']) and $_POST['notify'] == '1';
$user->setNotify($notify);
$user->save();
}
require_once('src/header.inc.php');
echo "<h3>Your Account</h3>";
if ($error != '') {
echo "<div class=\"errorbox\">$error</div>";
}
?>
<form action="" method="post">
<p>To change your password, enter your old and new passwords
below.</p>
<p><label>Old Password:
<input type="password" name="oldpassword" /></label></p>
<p><label>New Password:
<input type="password" name="newpassword" /></label></p>
<p><label>Confirm Password:
<input type="password" name="newpassword2" /></label></p>
<div style="margin-top: 2em; margin-bottom: 2em;">
<p><label><input type="checkbox" name="notify" value=\"1\" <?php
echo $_SESSION['currentUser']->getNotify() ? 'checked="checked"' : '';
?>/>
Notify when posts are created.</label></p>
</div>
<p><input type="submit" value="Update Account" /></p>
</form>
<?php
require_once('src/footer.inc.php');
?>
|