kevinoid / auth-mailbox-joomla

Plugin for Joomla! to authenticate users against a mail server using IMAP, NNTP, or POP3.
GNU General Public License v2.0
6 stars 0 forks source link
joomla-plugin php

Mailbox Authentication Plugin for Joomla!

This is a Joomla! plugin to authenticate users against a mail server via IMAP, NNTP, or POP3. It forwards authentication credentials provided by the user to a mail server, then relays the authentication decision of the mail server back to Joomla!.

In simpler terms, it lets users log in to Joomla! with the same username and password that they use for email, without the need to copy and synchronize the accounts manually.

Supported Features

Currently Unsupported Features

Plugin Requirements

Troubleshooting

Joomla! Logs

To get debugging information from the Joomla! logs:

  1. Enable Log Almost Everything from the "Logging" tab of the "System - Debug" plugin in the Extensions Plugin Manager?
  2. Attempt to log in.
  3. Open administrator/logs/everything.php from the Joomla! directory on your server in a text editor and search for authentication_mailbox near the end of the log file. The log messages should include the arguments to imap_open (excluding passwords) and the resulting messages from imap_errors.
    • If administrator/logs/everything.php does not exist, check that the directory permissions allow the PHP process to write to that directory.
    • If authentication_mailbox does not appear in administrator/logs/everything.php, check that "Authentication - Mailbox" is enabled in the Extensions Plugin Manager.

imap_open

If imap_open can not open the user's mailbox, it may be simpler to debug by calling imap_open from a test script such as the following:

<?php
header('Content-Type: text/plain');

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);

$mailbox = imap_open(
    '{imap.example.com/service=imap/tls/validate-cert}',
    'myusername',
    'mypassword',
    0,
    1);
print 'imap_open: ' . ($mailbox ? "Succeeded.\n" : "Failed.\n");

print 'imap_errors: ';
var_dump(imap_errors());

if ($mailbox) {
    imap_close($mailbox);
}
  1. Save the above code into a file (e.g. test.php).

  2. Adjust the imap_open parameters as necessary:

    1. Replace imap.example.com with a valid server (and replace /service=imap with /sevice=pop3 or /service=nntp as necessary).
    2. Replace myusername and mypassword with the username and password with a valid user and adjust any other parameters as desired.
    3. Add or remove flags such as OP_SECURE from the flags parameter.
  3. Upload the file to a web server.

  4. Visit the URL for the uploaded file in a web browser.

  5. Repeat steps 2-4 until the page contains:

    imap_open: Succeeded. imap_errors: bool(false)

  6. Adjust the plugin configuration to match the functional parameters.

Installation instructions are available in INSTALL.md. Major changes are listed in ChangeLog.txt. Complete license text is available in COPYING.txt.