This authentication module, changes the password check for dokuWiki, from using the password file, to use an IMAP or pop3 server. It is build on the plain authentication backend, and works in the same way, with the only change that user passwords are cheked against an IMAP/pop3 server.
NB: You still need to create you users in dokuWiki before they can log in.
Copy the file imap.class.php to “inc/auth”.
Or manually create the file by applying the following steps:
Copy the plain module:
cp plain.class.php imap.class.php
Change the following lines in the file imap.class.php:
[...] class auth_imap extends auth_basic { [...] function auth_imap() { [...] $this->cando['modPass'] = false; [...] function checkPass($user,$pass){ $userinfo = $this->getUserData($user); if ($userinfo === false) return false; $toReturn=false; $imap_login = @imap_open("{imap.server:143/novalidate-cert}", $user."@domain.tld", $pass, OP_HALFOPEN, 1); if ($imap_login == false){ $toReturn = false; } else { $toReturn = true; imap_close($imap_login); } return $toReturn; } [...] function createUser($user,$pwd,$name,$mail,$grps=null){ [...] $tmppass = time(); $pass = auth_cryptPassword($tmppass); [...]
Now update the IMAP/pop3 server connection string.
imap_open("{imap.server:143/novalidate-cert}", $user."@domain.tld", $pass, OP_HALFOPEN, 1);
See http://dk.php.net/imap_open for documentation on the imap_open function.
As noted in pam there seams to be a bug in the User Manager, it won't create a user if no password is specified. Fix it by either applying the patch on pam or by setting “$this→cando['modPass']” to true, and specifying a random password when the user is created.
Please leave your comments here.