]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Merge branch 'master' into develop
[friendica.git] / src / Model / User.php
index a253865c2331a903cb1684411fc591308184c55a..1df7e5ef4e4ffb5426b1405b722aa9509127d664 100644 (file)
@@ -5,6 +5,7 @@
  */
 namespace Friendica\Model;
 
+use DivineOmega\PasswordExposed\PasswordStatus;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
@@ -22,6 +23,7 @@ use Friendica\Util\Network;
 use dba;
 use Exception;
 use LightOpenID;
+use function password_exposed;
 
 require_once 'boot.php';
 require_once 'include/dba.php';
@@ -101,7 +103,7 @@ class User
         * @param string $password
         * @return int|boolean
         * @deprecated since version 3.6
-        * @see Friendica\Model\User::getIdFromPasswordAuthentication()
+        * @see User::getIdFromPasswordAuthentication()
         */
        public static function authenticate($user_info, $password)
        {
@@ -216,6 +218,17 @@ class User
                return autoname(6) . mt_rand(100, 9999);
        }
 
+       /**
+        * Checks if the provided plaintext password has been exposed or not
+        *
+        * @param string $password
+        * @return bool
+        */
+       public static function isPasswordExposed($password)
+       {
+               return password_exposed($password) === PasswordStatus::EXPOSED;
+       }
+
        /**
         * Legacy hashing function, kept for password migration purposes
         *