From 0f28f81f8911e432ae4bf50da7ed2c334618fd95 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 27 Dec 2012 15:14:44 +0400 Subject: move authentication modules to plugins/ --- plugins/auth_imap/auth_imap.php | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 plugins/auth_imap/auth_imap.php (limited to 'plugins/auth_imap') diff --git a/plugins/auth_imap/auth_imap.php b/plugins/auth_imap/auth_imap.php new file mode 100644 index 000000000..cca279cb3 --- /dev/null +++ b/plugins/auth_imap/auth_imap.php @@ -0,0 +1,51 @@ +link = $host->get_link(); + $this->host = $host; + $this->base = new Auth_Base($this->link); + + $host->add_hook($host::HOOK_AUTH_USER, $this); + } + + function authenticate($login, $password) { + + if ($login && $password) { + $imap = imap_open( + "{".IMAP_AUTH_SERVER.IMAP_AUTH_OPTIONS."}INBOX", + $login, + $password); + + if ($imap) { + imap_close($imap); + + return $this->base->auto_create_user($login); + } + } + + return false; + } + +} + +?> -- cgit v1.2.3