diff options
| author | czaks <marcin@6irc.net> | 2016-05-05 06:43:22 +0200 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2016-05-05 06:43:22 +0200 |
| commit | 7c3126866cd291d515ab5cc83d4635c3c95c6d85 (patch) | |
| tree | 8eb21f57b88e36c481da8f8a74c32ec52ce4f4ab /inc/mod/auth.php | |
| parent | 2caad907557e38eb0172f96d1e740e1077e81267 (diff) | |
ease the migration process for the previous security patch (by introducing another migration); restore php 5.4 compatibility (introducing a polyfill system)
Diffstat (limited to 'inc/mod/auth.php')
| -rw-r--r-- | inc/mod/auth.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/inc/mod/auth.php b/inc/mod/auth.php index fa1a0f4f..d877b89f 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -76,20 +76,20 @@ function generate_salt() { function login($username, $password) { global $mod, $config; - $query = prepare("SELECT `id`, `type`, `boards`, `password`, `salt` FROM ``mods`` WHERE `username` = :username"); + $query = prepare("SELECT `id`, `type`, `boards`, `password`, `version` FROM ``mods`` WHERE `username` = :username"); $query->bindValue(':username', $username); $query->execute() or error(db_error($query)); if ($user = $query->fetch(PDO::FETCH_ASSOC)) { - list($version, $ok) = test_password($user['password'], $user['salt'], $password); + list($version, $ok) = test_password($user['password'], $user['version'], $password); if ($ok) { if ($config['password_crypt_version'] > $version) { // It's time to upgrade the password hashing method! - list ($user['salt'], $user['password']) = crypt_password($password); - $query = prepare("UPDATE ``mods`` SET `password` = :password, `salt` = :salt WHERE `id` = :id"); + list ($user['version'], $user['password']) = crypt_password($password); + $query = prepare("UPDATE ``mods`` SET `password` = :password, `version` = :version WHERE `id` = :id"); $query->bindValue(':password', $user['password']); - $query->bindValue(':salt', $user['salt']); + $query->bindValue(':version', $user['version']); $query->bindValue(':id', $user['id']); $query->execute() or error(db_error($query)); } |
