mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #11158 from lekoala/patch-47
FIX Generate salt if needed
This commit is contained in:
commit
dba87348f9
@ -520,13 +520,11 @@ class Member extends DataObject
|
|||||||
|
|
||||||
// If the algorithm or salt is not available, it means we are operating
|
// If the algorithm or salt is not available, it means we are operating
|
||||||
// on legacy account with unhashed password. Do not hash the string.
|
// on legacy account with unhashed password. Do not hash the string.
|
||||||
if (!$this->PasswordEncryption) {
|
if (!$this->PasswordEncryption || !$this->Salt) {
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We assume we have PasswordEncryption and Salt available here.
|
|
||||||
$e = PasswordEncryptor::create_for_algorithm($this->PasswordEncryption);
|
$e = PasswordEncryptor::create_for_algorithm($this->PasswordEncryption);
|
||||||
|
|
||||||
return $e->encrypt($string, $this->Salt);
|
return $e->encrypt($string, $this->Salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user