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