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