]> git.mxchange.org Git - friendica.git/commitdiff
Catch missing Certainty bundle exception when checking for exposed password in Model...
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 13 Oct 2019 01:06:47 +0000 (21:06 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 13 Oct 2019 01:10:03 +0000 (21:10 -0400)
src/Model/User.php

index b6121ad04e07c46098f2eeec60b8cf8e17dbf07f..ef49f45edab1012f9873678c473f2137542d960f 100644 (file)
@@ -412,6 +412,7 @@ class User
         *
         * @param string $password
         * @return bool
+        * @throws Exception
         */
        public static function isPasswordExposed($password)
        {
@@ -420,9 +421,20 @@ class User
                        'cacheDirectory' => get_temppath() . '/password-exposed-cache/',
                ]);
 
-               $PasswordExposedCHecker = new PasswordExposed\PasswordExposedChecker(null, $cache);
+               try {
+                       $passwordExposedChecker = new PasswordExposed\PasswordExposedChecker(null, $cache);
+
+                       return $passwordExposedChecker->passwordExposed($password) === PasswordExposed\PasswordStatus::EXPOSED;
+               } catch (\Exception $e) {
+                       Logger::error('Password Exposed Exception: ' . $e->getMessage(), [
+                               'code' => $e->getCode(),
+                               'file' => $e->getFile(),
+                               'line' => $e->getLine(),
+                               'trace' => $e->getTraceAsString()
+                       ]);
 
-               return $PasswordExposedCHecker->passwordExposed($password) === PasswordExposed\PasswordStatus::EXPOSED;
+                       return false;
+               }
        }
 
        /**