]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added a CheckPassword event
authorCraig Andrews <candrews@integralblue.com>
Wed, 4 Nov 2009 18:06:55 +0000 (13:06 -0500)
committerCraig Andrews <candrews@integralblue.com>
Wed, 4 Nov 2009 18:06:55 +0000 (13:06 -0500)
EVENTS.txt
lib/util.php

index a8a77390f6c2ccfbcc45a55593d8c5df2b42445c..7be611c710d86b8aaea29ff8c89dd59fc4e170a3 100644 (file)
@@ -474,3 +474,8 @@ StartPublicXRDS: Start XRDS output (right after the opening XRDS tag)
 EndPublicXRDS: End XRDS output (right before the closing XRDS tag)
 - $action: the current action
 - &$xrdsoutputter - XRDSOutputter object to write to
+
+CheckPassword: Check a username/password
+- $nickname: The nickname to check
+- $password: The password to check
+- &$authenticated: set to true to indicate authentication succeeded.
index bf7282858abaea20dd4430c4d18780f77d5f9359..46aa7f90121f0edfc258e312ae48cf364ab1b3bf 100644 (file)
@@ -127,8 +127,17 @@ function common_check_user($nickname, $password)
     if (is_null($user) || $user === false) {
         return false;
     } else {
-        if (0 == strcmp(common_munge_password($password, $user->id),
-                        $user->password)) {
+        $authenticated = false;
+        Event::handle('CheckPassword', array($nickname, $password, &$authenticated));
+        if(! $authenticated){
+            //no handler asserted the user, so check ourselves
+            if (0 == strcmp(common_munge_password($password, $user->id),
+                            $user->password)) {
+                //internal checking passed
+                $authenticated = true;
+            }
+        }
+        if($authenticated){
             return $user;
         } else {
             return false;