Piwik\Plugins\UsersManager\UsersManager::checkPasswordHash PHP Method

checkPasswordHash() public static method

Checks the password hash length. Used as a sanity check.
public static checkPasswordHash ( string $passwordHash, string $exceptionMessage )
$passwordHash string The password hash to check.
$exceptionMessage string Message of the exception thrown.
    public static function checkPasswordHash($passwordHash, $exceptionMessage)
    {
        if (strlen($passwordHash) != 32) {
            // MD5 hash length
            throw new Exception($exceptionMessage);
        }
    }

Usage Example

Example #1
0
File: Auth.php Project: piwik/piwik
 /**
  * Sets the password hash to use when authentication.
  *
  * @param string $passwordHash The password hash.
  */
 public function setPasswordHash($passwordHash)
 {
     if ($passwordHash === null) {
         $this->hashedPassword = null;
         return;
     }
     // check that the password hash is valid (sanity check)
     UsersManager::checkPasswordHash($passwordHash, Piwik::translate('Login_ExceptionPasswordMD5HashExpected'));
     $this->hashedPassword = $passwordHash;
 }
All Usage Examples Of Piwik\Plugins\UsersManager\UsersManager::checkPasswordHash