login/pass: require new password value to be confirmed
[minimedit.git] / login / pass.inc.php
index 2b4665c01765a4b61fdbb247031725f9eb084e03..483f8bbb72aac517ea03d47f9a523a822e0aa404 100644 (file)
@@ -32,6 +32,10 @@ function passform($user, $input = [])
                return "De loginnaam is wel heel makkelijk raadbaar als wachtwoord.";
        }
 
+       if ($input['newpass'] != $input['passconf']) {
+               return "Zorg dat bij de bevestiging precies het zelfde wachtwoord staat.";
+       }
+
        if (!file_put_contents($pwfile, $input['newpass'])) {
                return "Het nieuwe wachtwoord kon niet worden opgeslagen. Het oude wachtwoord is behouden.";
        }
@@ -40,7 +44,9 @@ function passform($user, $input = [])
 
        $authhash = md5($input['newpass']);
        $user['auth'] = "{$user['name']}:$authhash";
-       login_setcookie();
+       if ($GLOBALS['User'] === $user) {
+               login_setcookie();
+       }
        return;
 }