mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-03 06:38:51 +02:00
Removing deprecated PasswordEncryptor::compare() method
Use PasswordEncryptor::check() instead
This commit is contained in:
parent
f122b103a1
commit
587d669861
@ -102,22 +102,6 @@ abstract class PasswordEncryptor {
|
|||||||
return substr($generator->generateHash('sha1'), 0, 50);
|
return substr($generator->generateHash('sha1'), 0, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This usually just returns a strict string comparison,
|
|
||||||
* but is necessary for {@link PasswordEncryptor_LegacyPHPHash}.
|
|
||||||
*
|
|
||||||
* @param String $hash1
|
|
||||||
* @param String $hash2
|
|
||||||
* @return boolean
|
|
||||||
*
|
|
||||||
* @deprecated 3.0 - Use PasswordEncryptor::check() instead.
|
|
||||||
*/
|
|
||||||
public function compare($hash1, $hash2) {
|
|
||||||
Deprecation::notice('3.0.0',
|
|
||||||
'PasswordEncryptor::compare() is deprecated, replaced by PasswordEncryptor::check().');
|
|
||||||
return ($hash1 === $hash2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This usually just returns a strict string comparison,
|
* This usually just returns a strict string comparison,
|
||||||
* but is necessary for retain compatibility with password hashed
|
* but is necessary for retain compatibility with password hashed
|
||||||
@ -356,15 +340,6 @@ class PasswordEncryptor_LegacyPHPHash extends PasswordEncryptor_PHPHash {
|
|||||||
return substr(base_convert($password, 16, 36), 0, 64);
|
return substr(base_convert($password, 16, 36), 0, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function compare($hash1, $hash2) {
|
|
||||||
Deprecation::notice('3.0.0',
|
|
||||||
'PasswordEncryptor::compare() is deprecated, replaced by PasswordEncryptor::check().');
|
|
||||||
|
|
||||||
// Due to flawed base_convert() floating poing precision,
|
|
||||||
// only the first 10 characters are consistently useful for comparisons.
|
|
||||||
return (substr($hash1, 0, 10) === substr($hash2, 0, 10));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function check($hash, $password, $salt = null, $member = null) {
|
public function check($hash, $password, $salt = null, $member = null) {
|
||||||
// Due to flawed base_convert() floating poing precision,
|
// Due to flawed base_convert() floating poing precision,
|
||||||
// only the first 10 characters are consistently useful for comparisons.
|
// only the first 10 characters are consistently useful for comparisons.
|
||||||
|
Loading…
Reference in New Issue
Block a user