Browse Source

bugfix: editing own user account caused errors

pull/40/head
Savetheinternet 13 years ago
parent
commit
4fd91e4523
  1. 11
      mod.php

11
mod.php

@ -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">';

Loading…
Cancel
Save