Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
ENH: refs #952. Added fix for pendingusers created pre-upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Grauer committed Mar 14, 2013
1 parent 9937d2f commit 030e441
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,10 @@ public function settingsAction()
throw new Zend_Exception('Changing password is disallowed for this user');
}
$oldPass = $this->_getParam('oldPassword');
if($userDao->getSalt() == '')
{
$passwordHash = $this->User->convertLegacyPasswordHash($userDao, $oldPass);
}
$newPass = $this->_getParam('newPassword');
$instanceSalt = Zend_Registry::get('configGlobal')->password->prefix;
$hashedPasswordOld = hash($userDao->getHashAlg(), $instanceSalt.$userDao->getSalt().$oldPass);
Expand Down
10 changes: 10 additions & 0 deletions core/database/upgrade/3.2.12.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ private function _movePasswords()
}
// Set the salt and hash alg to the appropriate value to denote a legacy user
$this->db->update('user', array('hash_alg' => 'md5', 'salt' => ''));
// Now the same for pending users
$sql = $this->db->select()
->from(array('pendinguser'), array('password'))
->distinct();
$rows = $this->db->fetchAll($sql);
foreach($rows as $row)
{
$this->db->insert('password', array('hash' => $row['password']));
}

}
}
?>

0 comments on commit 030e441

Please sign in to comment.