return "De loginnaam is wel heel makkelijk raadbaar als wachtwoord.";
}
- if (!file_put_contents($pwfile, $input['newpass'])) {
+ if ($input['newpass'] != $input['passconf']) {
+ return "Zorg dat bij de bevestiging precies het zelfde wachtwoord staat.";
+ }
+
+ $passstore = password_hash($input['newpass'], PASSWORD_DEFAULT);
+ if (empty($passstore) or !file_put_contents($pwfile, $passstore)) {
return "Het nieuwe wachtwoord kon niet worden opgeslagen. Het oude wachtwoord is behouden.";
}
$authhash = md5($input['newpass']);
$user['auth'] = "{$user['name']}:$authhash";
- login_setcookie();
+ if ($GLOBALS['User'] === $user) {
+ login_setcookie();
+ }
return;
}