1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Action\Exception\ActionAbort;
6use dokuwiki\Action\Exception\ActionDisabledException;
7use dokuwiki\Ui;
8
9/**
10 * Class Profile
11 *
12 * Handle the profile form
13 *
14 * @package dokuwiki\Action
15 */
16class Profile extends AbstractUserAction
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        if(!$auth->canDo('Profile')) throw new ActionDisabledException();
32    }
33
34    /** @inheritdoc */
35    public function preProcess()
36    {
37        global $lang;
38        if (updateprofile()) {
39            msg($lang['profchanged'], 1);
40            throw new ActionAbort('show');
41        }
42    }
43
44    /** @inheritdoc */
45    public function tplContent()
46    {
47        (new Ui\UserProfile)->show();
48    }
49
50}
51