diff --git a/action.php b/action.php index ad88c1b7f11b33629dc252566074256cd3fa8e0d..4258948e7dcad43d413542f554ff3595afb308a5 100644 --- a/action.php +++ b/action.php @@ -10,10 +10,23 @@ class action_plugin_authuffd extends DokuWiki_Action_Plugin if($conf['authtype'] != 'authuffd') return; $conf['profileconfirm'] = false; /* password confirmation doesn't work with SSO users */ - $controller->register_hook('HTML_LOGINFORM_OUTPUT', 'BEFORE', $this, 'handle_loginform'); + $controller->register_hook('FORM_LOGIN_OUTPUT', 'BEFORE', $this, 'handle_loginform'); + $controller->register_hook('HTML_LOGINFORM_OUTPUT', 'BEFORE', $this, 'handle_loginform_old'); } - function handle_loginform(Doku_Event &$event, $param) + function handle_loginform(Doku_Event &$event) + { + $form = $event->data; + do { + $form->removeElement(0); + } while ($form->elementCount() > 0); + $form->addFieldsetOpen('Login with:'); + $form->setHiddenField('oauth2_login', '1'); + $form->addButton('', $this->getConf('name'))->attr('type', 'submit'); + $form->addFieldsetClose(); + } + + function handle_loginform_old(Doku_Event &$event, $param) { $event->data->_content = array( form_openfieldset(array('_legend' => 'Login with:', 'class' => 'plugin_authuffd')), @@ -22,9 +35,4 @@ class action_plugin_authuffd extends DokuWiki_Action_Plugin form_closefieldset() ); } - - function handle_dologin(Doku_Event &$event, $param) - { - msg('handle_dologin'); - } } diff --git a/plugin.info.txt b/plugin.info.txt index 75c481fc38db4c009ad9c1f0696c3a2c9412c35c..336f363422d0349de20d6770754adef66d41e6d8 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base authuffd author Julian Rother email julian@cccv.de -date 2022-02-19 +date 2022-12-26 name Authentication with Uffd desc Auth plugin for login via uffd url https://git.cccv.de/uffd/dokuwiki-plugin-authuffd