]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OpenID/OpenIDPlugin.php
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / plugins / OpenID / OpenIDPlugin.php
index 7d6a5dc000e7c0d100d54c53ffadf3a894afc9a4..9c32074520ec366c517e5edde476f9b75554e365 100644 (file)
@@ -102,9 +102,14 @@ class OpenIDPlugin extends Plugin
     function onStartConnectPath(&$path, &$defaults, &$rules, &$result)
     {
         if (common_config('site', 'openidonly')) {
-            static $block = array('main/login',
-                                  'main/register',
-                                  'main/recoverpassword',
+            // Note that we should not remove the login and register
+            // actions. Lots of auth-related things link to them,
+            // such as when visiting a private site without a session
+            // or revalidating a remembered login for admin work.
+            //
+            // We take those two over with redirects to ourselves
+            // over in onArgsInitialize().
+            static $block = array('main/recoverpassword',
                                   'settings/password');
 
             if (in_array($path, $block)) {
@@ -630,6 +635,28 @@ class OpenIDPlugin extends Plugin
         return true;
     }
 
+    /**
+     * Add OpenID information to the Account Management Control Document
+     * Event supplied by the Account Manager plugin
+     *
+     * @param array &$amcd Array that expresses the AMCD
+     *
+     * @return boolean hook value
+     */
+
+    function onEndAccountManagementControlDocument(&$amcd)
+    {
+        $amcd['auth-methods']['openid'] = array(
+            'connect' => array(
+                'method' => 'POST',
+                'path' => common_local_url('openidlogin'),
+                'params' => array(
+                    'identity' => 'openid_url'
+                )
+            )
+        );
+    }
+
     /**
      * Add our version information to output
      *