🤖 Rector and PHPCS fixes
[dokuwiki.git] / inc / Action / Register.php
blob232d21a01514d547f88fd0b85c70679f2304dcb9
1 <?php
3 namespace dokuwiki\Action;
5 use dokuwiki\Ui\UserRegister;
6 use dokuwiki\Action\Exception\ActionAbort;
7 use dokuwiki\Action\Exception\ActionDisabledException;
8 use dokuwiki\Extension\AuthPlugin;
9 use dokuwiki\Ui;
11 /**
12 * Class Register
14 * Self registering a new user
16 * @package dokuwiki\Action
18 class Register extends AbstractAclAction
20 /** @inheritdoc */
21 public function minimumPermission()
23 return AUTH_NONE;
26 /** @inheritdoc */
27 public function checkPreconditions()
29 parent::checkPreconditions();
31 /** @var AuthPlugin $auth */
32 global $auth;
33 global $conf;
34 if (isset($conf['openregister']) && !$conf['openregister']) throw new ActionDisabledException();
35 if (!$auth->canDo('addUser')) throw new ActionDisabledException();
38 /** @inheritdoc */
39 public function preProcess()
41 if (register()) { // FIXME could be moved from auth to here
42 throw new ActionAbort('login');
46 /** @inheritdoc */
47 public function tplContent()
49 (new UserRegister())->show();