]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/ExAuth.php
Cut and paste is always fun
[friendica.git] / src / Util / ExAuth.php
index 0769be2e66cf742bc4299fc1b0d219f5a1f41220..f4dc7c052beefa17b49e2648a2a3d9b81d60dda5 100644 (file)
@@ -37,6 +37,7 @@ namespace Friendica\Util;
 use Friendica\Core\Config;\r
 use Friendica\Core\PConfig;\r
 use Friendica\Database\DBM;\r
+use Friendica\Model\User;\r
 use dba;\r
 \r
 require_once 'include/dba.php';\r
@@ -217,8 +218,8 @@ class ExAuth
 \r
                        $aUser = dba::select('user', ['uid', 'password'], ['nickname' => $sUser], ['limit' => 1]);\r
                        if (DBM::is_result($aUser)) {\r
-                               $uid = $aUser['uid'];\r
-                               $Error = $aUser['password'] != hash('whirlpool', $aCommand[3]);\r
+                               $uid = User::authenticate($aUser, $aCommand[3]);\r
+                               $Error = $uid === false;\r
                        } else {\r
                                $this->writeLog(LOG_WARNING, 'user not found: ' . $sUser);\r
                                $Error = true;\r
@@ -226,7 +227,7 @@ class ExAuth
                        }\r
                        if ($Error) {\r
                                $this->writeLog(LOG_INFO, 'check against alternate password for ' . $sUser . '@' . $aCommand[2]);\r
-                               $sPassword = PConfig::get($uid, 'xmpp', 'password');\r
+                               $sPassword = PConfig::get($uid, 'xmpp', 'password', null, true);\r
                                $Error = ($aCommand[3] != $sPassword);\r
                        }\r
                } else {\r