Remove SQL column legacy_password

This commit is contained in:
Alexandre Alapetite
2018-04-08 14:53:12 +02:00
parent cb26cd6d5d
commit 82f1f2f00e
5 changed files with 5 additions and 12 deletions

View File

@@ -149,12 +149,9 @@ function update_1203() {
}
function update_1244() {
// Sets legacy_password for all legacy hashes
dba::update('user', ['legacy_password' => true], ['SUBSTR(password, 1, 4) != "$2y$"']);
// All legacy hashes are re-hashed using the new secure hashing function
$stmt = dba::select('user', ['uid', 'password'], ['legacy_password' => true]);
while($user = dba::fetch($stmt)) {
$stmt = dba::select('user', ['uid', 'password'], ['password NOT LIKE "$%"']);
while ($user = dba::fetch($stmt)) {
dba::update('user', ['password' => User::hashPassword($user['password'])], ['uid' => $user['uid']]);
}