login/pass: encrypt user input in profile data
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 14 Jun 2018 15:00:15 +0000 (17:00 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 14 Jun 2018 15:00:15 +0000 (17:00 +0200)
Left cleartext for debugging, but prefer at least blowfish hashing.
Assume PHP v5.5 to generate salts.

login/pass.inc.php

index 483f8bbb72aac517ea03d47f9a523a822e0aa404..cb2427e2babfdc0c77b6fd79b4b7de5099dbda95 100644 (file)
@@ -36,7 +36,8 @@ function passform($user, $input = [])
                return "Zorg dat bij de bevestiging precies het zelfde wachtwoord staat.";
        }
 
-       if (!file_put_contents($pwfile, $input['newpass'])) {
+       $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.";
        }