Support any php default password hash algorithm change

SVN:trunk[5998]
This commit is contained in:
Stephen Abello
2018-08-03 14:52:05 +00:00
parent dd46048ea6
commit 135d9c5e55

View File

@@ -96,12 +96,10 @@ class ormPassword
{ {
$bResult = false; $bResult = false;
$aInfo = password_get_info($this->m_sHashed); $aInfo = password_get_info($this->m_sHashed);
switch ($aInfo["algoName"]) switch ($aInfo["algo"])
{ {
case 'bcrypt': case 0:
$bResult = password_verify($sClearTextPassword, $this->m_sHashed); //unknown, assume it's a legacy password
break;
case 'unknown':
$sHashedPwd = $this->ComputeHash($sClearTextPassword); $sHashedPwd = $this->ComputeHash($sClearTextPassword);
if ($this->m_sHashed == $sHashedPwd) if ($this->m_sHashed == $sHashedPwd)
{ {
@@ -109,7 +107,7 @@ class ormPassword
} }
break; break;
default: default:
//shouldn't happen until php modify PASSWORD_DEFAULT $bResult = password_verify($sClearTextPassword, $this->m_sHashed);
} }
return $bResult; return $bResult;
} }