Refactor SettingsUpdatePassword and PasswordManager to improve password validation and ensure UUID integrity
https://github.com/nosial/Socialbox-PHP/issues/70
This commit is contained in:
parent
76a343a36d
commit
9c8945141c
2 changed files with 11 additions and 15 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace Socialbox\Managers;
|
||||
|
||||
use DateTime;
|
||||
use InvalidArgumentException;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
use Socialbox\Classes\Configuration;
|
||||
|
@ -28,6 +29,10 @@
|
|||
{
|
||||
$peerUuid = $peerUuid->getUuid();
|
||||
}
|
||||
elseif(!Validator::validateUuid($peerUuid))
|
||||
{
|
||||
throw new InvalidArgumentException('The given internal peer UUID is not a valid UUID V4');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -97,10 +102,14 @@
|
|||
{
|
||||
$peerUuid = $peerUuid->getUuid();
|
||||
}
|
||||
elseif(!Validator::validateUuid($peerUuid))
|
||||
{
|
||||
throw new CryptographyException('The given internal peer UUID is not a valid UUID V4');
|
||||
}
|
||||
|
||||
if(!Cryptography::validatePasswordHash($hash))
|
||||
{
|
||||
throw new CryptographyException('Invalid password hash');
|
||||
throw new CryptographyException('Invalid password argon2id hash');
|
||||
}
|
||||
|
||||
$encryptionKey = Configuration::getCryptographyConfiguration()->getRandomInternalEncryptionKey();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue