]> git.wh0rd.org Git - tt-rss.git/commitdiff
add IMAP authenticator module (closes #485)
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 27 Dec 2012 06:26:04 +0000 (10:26 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 27 Dec 2012 06:26:04 +0000 (10:26 +0400)
classes/auth/imap.php [new file with mode: 0644]

diff --git a/classes/auth/imap.php b/classes/auth/imap.php
new file mode 100644 (file)
index 0000000..52664eb
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/* Requires php-imap
+       Put the following options in config.php:
+
+       define('IMAP_AUTH_SERVER', 'your.imap.server:port');
+       define('IMAP_AUTH_OPTIONS', '/tls/novalidate-cert/norsh');
+       // More about options: http://php.net/manual/ru/function.imap-open.php
+
+ */
+
+class Auth_Imap extends Auth_Base {
+
+       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->auto_create_user($login);
+                       }
+               }
+
+               return false;
+       }
+
+}
+?>