afterlogic / webmail-lite-8

Open-source webmail script for existing IMAP server
https://afterlogic.org/webmail-lite-8
GNU Affero General Public License v3.0
335 stars 71 forks source link

Auto-provisioning of new users doesn't work for the mail login form. #47

Closed pbsds closed 5 years ago

pbsds commented 5 years ago

I want to present a simple user login for my users, not having to type out the pesky domain. I therefore switched over to using the "mail" login form instead of the "login" login form. But it seems the "mail" login form is unable to create new users automatically.

My steps to reproduce:

Version

Running on FreeBSD with lighttpd Afterlogic WebMail Lite PHP 8.3.7-build-a3

afterlogic-support commented 5 years ago

Can you please confirm whether you have "Use full email address as login" option checked for the mail server you have added? Thank you.

afterlogic-support commented 5 years ago

Also, please check if there are any errors in the debug log when new user gets created. Make sure to set LogStackTrace to true in data/settings/config.json file.

pbsds commented 5 years ago

Thanks for the quick response, I've made some logs:

Here the "Use full email address as login" is unchecked, and I attempt to log in as a new user in the "mail" form: log

Here is a successfull login attempt using the "login" form of a new user: log

Here is a successfull login attempt using the "mail" form with an existing user: log

Now I check the "Use full email address as login" option and delete my user. When I attempt to log in using the "mail" form I get The username or password you entered is incorrect. (TAG1 NO (AUTHENTICATIONFAILED) Authentication failed.) after a short wait: log

I am also now unable to log in using the "login" form with my new user: log (perhaps due to "Use full email address as login" being checked?)

afterlogic-support commented 5 years ago

Thank you, developers will take a look. Will let you know once there's a response.

afterlogic-support commented 5 years ago

Please try modifying modules/MailLoginFormWebclient/Module.php file, line ~58:

$aGetMailServerResult = \Aurora\System\Api::getModule('Mail')->GetMailServerByDomain(strtolower($sDomain), /*AllowWildcardDomain*/true);

as follows:

$aGetMailServerResult = \Aurora\System\Api::GetModuleDecorator('Mail')->GetMailServerByDomain(strtolower($sDomain), /*AllowWildcardDomain*/true);

and let us know if this helps. If not, we'll need the updated logs. Thank you.

-- Regards, Igor, Afterlogic Support

pbsds commented 5 years ago

Didn't work

"Use full email address as login" is unchecked:

"Use full email address as login" is checked:

The cases with * appended have my password replaced with 'hunter2'

afterlogic-support commented 5 years ago

OK thank you. Would it be possible to provide our developers with admin access to your installation? We're also going to need a test account the issue can be reproduced with. Please provide the access details via HelpDesk. Thank you.

afterlogic-support commented 5 years ago

Follow-up: we were finally able to reproduce the issue on our installation. Will get back to you once there are news.

afterlogic-support commented 5 years ago

Please replace the following code in modules/MailLoginFormWebclient/Module.php file (line ~65) :

if ($oServer->UseFullEmailAddressAsLogin)
    {
        $sIncomingLogin = $sEmail;
        $bAutocreateMailAccountOnNewUserFirstLogin = \Aurora\Modules\Mail\Module::Decorator()->getConfig('AutocreateMailAccountOnNewUserFirstLogin', false);
    }
    else
    {
        $sIncomingLogin = $sLogin;
        $bAutocreateMailAccountOnNewUserFirstLogin = false;
    }

with:

$bAutocreateMailAccountOnNewUserFirstLogin = \Aurora\Modules\Mail\Module::Decorator()->getConfig('AutocreateMailAccountOnNewUserFirstLogin', false);
$sIncomingLogin = $oServer->UseFullEmailAddressAsLogin ? $sEmail : $sLogin;

And let us know if this helps you. Thanks!

afterlogic-support commented 5 years ago

Also, we've just uploaded version 8.3.9 containing this correction and other improvements https://afterlogic.org/download/webmail-lite-php

pbsds commented 5 years ago

Thanks for the help and sorry for my late reply. This fixed it