[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Action/ -> Register.php (source)

   1  <?php
   2  
   3  namespace dokuwiki\Action;
   4  
   5  use dokuwiki\Action\Exception\ActionAbort;
   6  use dokuwiki\Action\Exception\ActionDisabledException;
   7  use dokuwiki\Ui;
   8  
   9  /**
  10   * Class Register
  11   *
  12   * Self registering a new user
  13   *
  14   * @package dokuwiki\Action
  15   */
  16  class Register extends AbstractAclAction
  17  {
  18      /** @inheritdoc */
  19      public function minimumPermission()
  20      {
  21          return AUTH_NONE;
  22      }
  23  
  24      /** @inheritdoc */
  25      public function checkPreconditions()
  26      {
  27          parent::checkPreconditions();
  28  
  29          /** @var \dokuwiki\Extension\AuthPlugin $auth */
  30          global $auth;
  31          global $conf;
  32          if (isset($conf['openregister']) && !$conf['openregister']) throw new ActionDisabledException();
  33          if (!$auth->canDo('addUser')) throw new ActionDisabledException();
  34      }
  35  
  36      /** @inheritdoc */
  37      public function preProcess()
  38      {
  39          if (register()) { // FIXME could be moved from auth to here
  40              throw new ActionAbort('login');
  41          }
  42      }
  43  
  44      /** @inheritdoc */
  45      public function tplContent()
  46      {
  47          (new Ui\UserRegister)->show();
  48      }
  49  
  50  }