This extension validates DokuWiki user's passwords against their system password using PHP's imap-open function. mail still uses conf/users.auth.php for user and group definition.
Config options in conf/local.php:
<?php // use mail as basis for authorization $conf['authtype'] = 'mail'; // imap_open's first parameter (host, protocol) to validate login / password // see http://www.php.net/manual/en/function.imap-open.php for more detail. $conf['mailserver'] = '{localhost:995/pop3/ssl/novalidate-cert}'; //$conf['mailserver'] = '{localhost:110/pop3/notls}'; ?>
Additional php class inc/auth/mail.class.php source code:
<?php /** * IMAP based authorization backend * Other user properties are stored in conf/users.auth.php * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Lukas Karrer <lukas.karrer@stimmt.ch> * * Idea initially by lss <lsslss@gmail.com> with modification * from jpgeorget (option to use plain_auth in the same time) */ define('DOKU_AUTH', dirname(__FILE__)); require_once(DOKU_AUTH.'/plain.class.php'); class auth_mail extends auth_plain { /** * Check user+password [required auth function] * * Checks if the given user exists and the given * plaintext password is correct * * @author Lukas Karrer <lukas.karrer@stimmt.ch> * @modify from Andreas Gohr <andi@splitbrain.org> * @return bool */ function checkPass($user,$pass){ global $conf; $userinfo = $this->getUserData($user); if ($userinfo === false) { msg ("No valid Dokuwiki user found.",0); return false; } if ( $mbox = @imap_open ($conf['mailserver'], $user, $pass) ) { imap_close( $mbox ); return true; } else { // Uncomment the line below if you do not want to check password entries in // DokuWiki user auth file. // return false; msg ("Mail password check failed. Reverting to DokuWiki password file",0); return auth_verifyPassword($pass,$this->users[$user]['pass']); } } } //Setup VIM: ex: et ts=2 enc=utf-8 :
Now, users with a valid mail account can login using their mail password.
— lss 2005-03-17 04:36 — updates by jpgeorget 2005-09-12 and Lukas Karrer 2006-06-09