[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Action/ -> Authtoken.php (source)

   1  <?php
   2  
   3  namespace dokuwiki\Action;
   4  
   5  use dokuwiki\Action\Exception\ActionAbort;
   6  use dokuwiki\Action\Exception\ActionException;
   7  use dokuwiki\JWT;
   8  
   9  class Authtoken extends AbstractUserAction
  10  {
  11      /** @inheritdoc */
  12      public function minimumPermission()
  13      {
  14          return AUTH_NONE;
  15      }
  16  
  17      /** @inheritdoc */
  18      public function checkPreconditions()
  19      {
  20          parent::checkPreconditions();
  21  
  22          if (!checkSecurityToken()) throw new ActionException('profile');
  23      }
  24  
  25      /** @inheritdoc */
  26      public function preProcess()
  27      {
  28          global $INPUT;
  29          parent::preProcess();
  30          $token = JWT::fromUser($INPUT->server->str('REMOTE_USER'));
  31          $token->save();
  32          throw new ActionAbort('profile');
  33      }
  34  }