/** * Check if a password matches * * @param mixed $user * @param string $password * @param bool $alltables * @return bool */ public static function passwordMatches($user = null, $password, $alltables = false) { $passhash = null; $hzup = self::getInstance($user); if (is_object($hzup) && !empty($hzup->passhash)) { $passhash = $hzup->passhash; } else { if ($alltables) { $profile = Profile::getInstance($user); if (is_object($profile) && $profile->get('userPassword') != '') { $passhash = $profile->get('userPassword'); } else { $user = \User::getInstance($user); if (is_object($user) && !empty($user->password)) { $passhash = $user->password; } } } } return self::comparePasswords($passhash, $password); }