added pop3 login feature to the gui

This commit is contained in:
SJ 2013-09-30 21:43:41 +02:00
parent ecf8c91e9a
commit c37ed257ae
2 changed files with 39 additions and 0 deletions

View File

@ -99,6 +99,12 @@ $config['IMAP_HOST'] = 'mail.yourdomain.com';
$config['IMAP_PORT'] = 993; $config['IMAP_PORT'] = 993;
$config['IMAP_SSL'] = true; $config['IMAP_SSL'] = true;
// enable authentication against a pop3 server (disabled by default)
$config['ENABLE_POP3_AUTH'] = 0;
$config['POP3_HOST'] = 'mail.yourdomain.com';
$config['POP3_PORT'] = 995;
$config['POP3_SSL'] = true;
// enable authentication against google (disabled by default) // enable authentication against google (disabled by default)
// see http://www.mailpiler.org/en/google-apps-free.html for details // see http://www.mailpiler.org/en/google-apps-free.html for details

View File

@ -18,6 +18,11 @@ class ModelUserAuth extends Model {
if($ok == 1) { return $ok; } if($ok == 1) { return $ok; }
} }
if(ENABLE_POP3_AUTH == 1) {
require 'Zend/Mail/Protocol/Pop3.php';
$ok = $this->checkLoginAgainstPOP3($username, $password);
if($ok == 1) { return $ok; }
}
// fallback local auth // fallback local auth
@ -255,6 +260,34 @@ class ModelUserAuth extends Model {
} }
private function checkLoginAgainstPOP3($username = '', $password = '') {
$user = array();
$rc = 0;
try {
$conn = new Zend_Mail_Protocol_Pop3(POP3_HOST, POP3_PORT, POP3_SSL);
if($conn) {
$s = $conn->connect(POP3_HOST);
if($s) {
try {
$conn->login($username, $password);
$this->add_session_vars($username, $username, array($username), 0);
$rc = 1;
}
catch (Zend_Mail_Protocol_Exception $e) {}
}
}
}
catch (Zend_Mail_Protocol_Exception $e) {}
return $rc;
}
public function check_ntlm_auth() { public function check_ntlm_auth() {
$ldap_mail_attr = 'mail'; $ldap_mail_attr = 'mail';
$ldap_account_objectclass = 'user'; $ldap_account_objectclass = 'user';