Improvement function hashPassword

This commit is contained in:
Marco Antonio Nina
2014-10-02 17:05:53 -04:00
parent edfba243e7
commit d3ba2d9a07

View File

@@ -2879,10 +2879,9 @@ class Bootstrap
$encrypt = $typeEncrypt['previous']; $encrypt = $typeEncrypt['previous'];
} }
} }
if ($includeHashType) {
$var = $encrypt . ':' . $pass;
} else {
eval("\$var = hash('" . $encrypt . "', '" . $pass . "');"); eval("\$var = hash('" . $encrypt . "', '" . $pass . "');");
if ($includeHashType) {
$var = $encrypt . ':' . $var;
} }
return $var; return $var;
@@ -2892,11 +2891,11 @@ class Bootstrap
{ {
$hashType = Bootstrap::getPasswordHashType(); $hashType = Bootstrap::getPasswordHashType();
if (Bootstrap::hashPassword($pass, $hashType) == $userPass if (Bootstrap::hashPassword($pass, $hashType) == $userPass
|| Bootstrap::hashPassword($pass, $hashType, true) == $userPass) { || $pass === Bootstrap::hashPassword($userPass, $hashType, true)) {
return true; return true;
} }
if (Bootstrap::hashPassword($pass, $hashType, false, true) == $userPass if (Bootstrap::hashPassword($pass, $hashType, false, true) == $userPass
|| Bootstrap::hashPassword($pass, $hashType, true, true) == $userPass) { ||$pass === Bootstrap::hashPassword($userPass, $hashType, true, true)) {
return true; return true;
} }
return false; return false;