DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:ondeniedlogin

ondeniedlogin Plugin

Compatible with DokuWiki

No compatibility info given!

plugin redirects unknown users to a login form on denied requests

Last updated on
2009-04-21
Provides
Action
Conflicts with
forcessllogin, showlogin, showlogin2

This extension is marked as obsoleted. Therefore it is hidden in the Extension Manager and the extension listing. Furthermore, it is candidate for removal.

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to showlogin, showlogin2

Tagged with !obsolete, authentication, denied, redirect

Functionality now included in DokuWiki: Dokuwiki now includes the login form in the denied page, when useful. So this plugin is obsolete.

EDIT by asheenlevrai on 20140924: Well I do not completely agree although the above is true for most users. On the 2014 version of dokuwiki (Ponder Stibbons) the denied page now includes the login form, while this plugin redirects to the login page whenever someone ends up on the denied page. People who use a customized version of the login page (for instance when using the plugin legal notice may still want to have the login page rather than the permission denied page displayed at all times since the new (2014) denied page will not include these customizations.
Fixed in legal notice for some time now - it also listens to “denied” action and will display it's text there, too. — Christian Marg 2016-08-22 10:46

Download and Installation

FIXME Downloads have error. Missing “php” in first line. Use copy and paste method or edit the file noted in copy and paste method.

Search and install the plugin using the Extension Manager.

Refer to Plugins on how to install plugins manually. Or copy paste this code into your lib/plugins/ondeniedlogin/action.php .

action.php
<?php
  if(!defined('DOKU_INC')) die();
  if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
  require_once(DOKU_PLUGIN.'action.php');
 
  class action_plugin_ondeniedlogin extends DokuWiki_Action_Plugin {
 
    function getInfo(){
      return array(
        'author' => 'Samuel Fischer',
        'email'  => 'sf@notomorrow.de',
        'date'   => '2009-04-21',
        'name'   => 'ondeniedlogin',
        'desc'   => 'redirects unknown users to a login form on denied requests',
        'url'    => 'http://www.dokuwiki.org/plugin:ondeniedlogin',
      );
    }
 
  function register(Doku_Event_Handler $controller) {
      $controller->register_hook('TPL_ACT_RENDER', 'BEFORE',  $this, 'ondeniedlogin');
    }
 
    function ondeniedlogin(&$event, $param) {
        global $ACT, $INFO;
 
        if($ACT!='denied') return;
          if(!is_array($INFO['userinfo']))
                $ACT = 'login';
    }
 
  }

Patches

Show Search Page for Authenticated Users

This adds the following functionality to this plugin: When your ACLs allow someone to see some pages but maybe not the start page, this helps him because he gets some search hits instead of “Permission denied”…

ondenied-search.patch
--- ondeniedlogin/action.php    2011-08-26 16:47:00.000000000 +0200
+++ ondeniedlogin/action.php    2011-08-26 16:54:23.000000000 +0200
@@ -26,6 +26,8 @@
       if($ACT!='denied') return;
         if(!is_array($INFO['userinfo']))
        $ACT = 'login';
+        else
+       $ACT = 'search';
     }
 
   }

Use Earlier Event

Some templates (e.g. dokuwiki) set html classes on outer elements describing the action. The TPL_ACT_RENDER event is too late to alter this. The change below switches to use ACTION_HEADERS_SEND, so immediately after DokuWiki sends the 403 permission denied header.

      $controller->register_hook('ACTION_HEADERS_SEND', 'AFTER',  $this, 'ondeniedlogin');
plugin/ondeniedlogin.txt · Last modified: 2018-06-05 19:04 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki