bugfix: editing own user account caused errors

This commit is contained in:
Savetheinternet 2011-12-10 13:40:48 +11:00
parent c83d192103
commit 4fd91e4523

11
mod.php
View File

@ -1186,7 +1186,8 @@
header('Location: ?/users', true, $config['redirect_http']); header('Location: ?/users', true, $config['redirect_http']);
} else { } else {
// Edit user // Edit user
if(!hasPermission($config['mod']['editusers']) && !hasPermission($config['mod']['change_password'])) error($config['error']['noaccess']); if(!hasPermission($config['mod']['editusers']) && !hasPermission($config['mod']['change_password']))
error($config['error']['noaccess']);
$query = prepare("SELECT * FROM `mods` WHERE `id` = :id"); $query = prepare("SELECT * FROM `mods` WHERE `id` = :id");
$query->bindValue(':id', $modID, PDO::PARAM_INT); $query->bindValue(':id', $modID, PDO::PARAM_INT);
@ -1232,14 +1233,18 @@
if(!$_mod = $query->fetch()) { if(!$_mod = $query->fetch()) {
error($config['error']['404']); error($config['error']['404']);
} }
if($_mod['id'] == $mod['id']) { if($_mod['id'] == $mod['id']) {
// Changed own password. Update cookies // Changed own password. Update cookies
login($mod['username'], $_POST['password']); if(!login($_mod['username'], $_mod['password'], false, true))
error('Could not re-login after changing password. (?)');
setCookies(); setCookies();
} }
header('Location: ?/users', true, $config['redirect_http']);
exit;
} }
$__boards = '<ul style="list-style:none;padding:2px 5px">'; $__boards = '<ul style="list-style:none;padding:2px 5px">';