Switch to a more secure method for generation of the token for request for a password restore

This commit is contained in:
Fedor A. Fetisov 2013-09-13 19:36:56 +04:00
parent e61706955a
commit 2334a0ed0a

View File

@ -38,7 +38,8 @@ if (isset($_POST['loginoremail'])) {
}
if (count($errors) == 0) {
$token = md5((time() + microtime()) . rand(0, 99999999));
$token = sha1($torestore['vclogin'] . (function_exists('openssl_random_pseudo_bytes') ? openssl_random_pseudo_bytes(32) : (time() + microtime()) . mt_rand(0, 99999999)));
$link = connect();
$query = sprintf("update ${mysqlprefix}chatoperator set dtmrestore = CURRENT_TIMESTAMP, vcrestoretoken = '%s' where operatorid = %s", mysql_real_escape_string($token, $link), intval($torestore['operatorid']));