]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/login.php
Added a configuration option to disable OpenID.
[quix0rs-gnu-social.git] / actions / login.php
index b049791fb1858dac3d79625317efa0ae77bb5bd9..6f1b4777e5ddb2f8960ab4a80c4e8e61480922de 100644 (file)
@@ -55,7 +55,7 @@ class LoginAction extends Action
      * @return boolean false
      */
 
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return false;
     }
@@ -65,6 +65,8 @@ class LoginAction extends Action
      *
      * Switches on request method; either shows the form or handles its input.
      *
+     * Checks if only OpenID is allowed and redirects to openidlogin if so.
+     *
      * @param array $args $_REQUEST data
      *
      * @return void
@@ -73,7 +75,9 @@ class LoginAction extends Action
     function handle($args)
     {
         parent::handle($args);
-        if (common_is_real_login()) {
+        if (common_config('site', 'openidonly')) {
+            common_redirect(common_local_url('openidlogin'));
+        } else if (common_is_real_login()) {
             $this->clientError(_('Already logged in.'));
         } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->checkLogin();
@@ -138,7 +142,7 @@ class LoginAction extends Action
                                           $nickname));
         }
 
-        common_redirect($url);
+        common_redirect($url, 303);
     }
 
     /**
@@ -247,11 +251,15 @@ class LoginAction extends Action
             return _('For security reasons, please re-enter your ' .
                      'user name and password ' .
                      'before changing your settings.');
-        } else {
+        } else if (common_config('openid', 'enabled')) {
             return _('Login with your username and password. ' .
                      'Don\'t have a username yet? ' .
                      '[Register](%%action.register%%) a new account, or ' .
                      'try [OpenID](%%action.openidlogin%%). ');
+        } else {
+            return _('Login with your username and password. ' .
+                     'Don\'t have a username yet? ' .
+                     '[Register](%%action.register%%) a new account.');
         }
     }