Merge pull request #5971 from MrPetovan/bug/5970-use-temppath-passwordexposed

Use system.temppath for PasswordExposedChecker cache
This commit is contained in:
Michael Vogel 2018-10-19 19:00:00 +02:00 committed by GitHub
commit d6864311e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -92,6 +92,10 @@ optimize_max_tablesize = -1
; Set to 0 to disable, 2 to enable, 1 is deprecated but wont need mcrypt. ; Set to 0 to disable, 2 to enable, 1 is deprecated but wont need mcrypt.
rino_encrypt = 2 rino_encrypt = 2
; temppath (String)
; Custom temporary file directory
temppath =
; theme (String) ; theme (String)
; System theme name. ; System theme name.
theme = vier theme = vier

View file

@ -5,7 +5,7 @@
*/ */
namespace Friendica\Model; namespace Friendica\Model;
use DivineOmega\PasswordExposed\PasswordStatus; use DivineOmega\PasswordExposed;
use Exception; use Exception;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
@ -20,7 +20,6 @@ use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use LightOpenID; use LightOpenID;
use function password_exposed;
require_once 'boot.php'; require_once 'boot.php';
require_once 'include/dba.php'; require_once 'include/dba.php';
@ -280,7 +279,14 @@ class User
*/ */
public static function isPasswordExposed($password) public static function isPasswordExposed($password)
{ {
return password_exposed($password) === PasswordStatus::EXPOSED; $cache = new \DivineOmega\DOFileCachePSR6\CacheItemPool();
$cache->changeConfig([
'cacheDirectory' => get_temppath() . '/password-exposed-cache/',
]);
$PasswordExposedCHecker = new PasswordExposed\PasswordExposedChecker(null, $cache);
return $PasswordExposedCHecker->passwordExposed($password) === PasswordExposed\PasswordStatus::EXPOSED;
} }
/** /**