X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/fbd07af24c03fe601af07f91eba2ceb996a8bd05..73362ad67d9e983d7ab26c068e4d595069bf01ef:/login/pass.inc.php diff --git a/login/pass.inc.php b/login/pass.inc.php index 2b4665c..cb2427e 100644 --- a/login/pass.inc.php +++ b/login/pass.inc.php @@ -32,7 +32,12 @@ function passform($user, $input = []) 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."; } @@ -40,7 +45,9 @@ function passform($user, $input = []) $authhash = md5($input['newpass']); $user['auth'] = "{$user['name']}:$authhash"; - login_setcookie(); + if ($GLOBALS['User'] === $user) { + login_setcookie(); + } return; }