You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

52 lines
1.1 KiB

  1. <?php
  2. namespace dokuwiki\Action;
  3. use dokuwiki\Ui\UserRegister;
  4. use dokuwiki\Action\Exception\ActionAbort;
  5. use dokuwiki\Action\Exception\ActionDisabledException;
  6. use dokuwiki\Extension\AuthPlugin;
  7. use dokuwiki\Ui;
  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. {
  20. return AUTH_NONE;
  21. }
  22. /** @inheritdoc */
  23. public function checkPreconditions()
  24. {
  25. parent::checkPreconditions();
  26. /** @var 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. /** @inheritdoc */
  33. public function preProcess()
  34. {
  35. if (register()) { // FIXME could be moved from auth to here
  36. throw new ActionAbort('login');
  37. }
  38. }
  39. /** @inheritdoc */
  40. public function tplContent()
  41. {
  42. (new UserRegister())->show();
  43. }
  44. }