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

login-failed : Aurora\System\Exceptions\ApiException: ApiException #22

Closed hardware closed 6 years ago

hardware commented 6 years ago

Hi all,

I can't figure out why imap authentication doesn't work. The webmail does not even try to communicate with the mail server, an exception is thrown before any connection attempt.

I tried with PHP 7.1 and 7.2 without success. No errors in Nginx and PHP logs. This is not an authentication issue on my end, I tried with rainloop without any issue.

Do you have an idea ?

Afterlogic Webmail Lite debug logs ``` [08:38:46.00][b45e63c7] [POST(4)][ip:xx.xx.xx.xx] /?/Api/ [08:38:46.00][b45e63c7] POST > [Module, Method, TenantName, Parameters] [08:38:46.00][b45e63c7] [08:38:46.00][b45e63c7] API: StandardLoginFormWebclient::Login [08:38:46.00][b45e63c7] Execute subscription: AdminAuth::onLogin [08:38:46.01][b45e63c7] Execute subscription: Mail::onLogin [08:38:46.01][b45e63c7] Event: 0 > login-failed: contact@domain.tld [08:38:46.01][b45e63c7] Aurora\System\Exceptions\ApiException: ApiException in /afterlogic-webmail-lite/modules/Core/Module.php:1840 Stack trace: #0 [internal function]: Aurora\Modules\Core\Module->Login('contact@domain.tld', 'xxxxxxxxxxx', '', false) #1 /afterlogic-webmail-lite/system/Module/AbstractModule.php(875): call_user_func_array(Array, Array) #2 /afterlogic-webmail-lite/system/Module/Decorator.php(42): Aurora\System\Module\AbstractModule->CallMethod('Login', Array) #3 /afterlogic-webmail-lite/modules/StandardLoginFormWebclient/Module.php(45): Aurora\System\Module\Decorator->__call('Login', Array) #4 [internal function]: Aurora\Modules\StandardLoginFormWebclient\Module->Login('contact@domain.tld', 'xxxxxxxxxxx', '', false) #5 /afterlogic-webmail-lite/system/Module/AbstractModule.php(875): call_user_func_array(Array, Array) #6 /afterlogic-webmail-lite/modules/Core/Module.php(535): Aurora\System\Module\AbstractModule->CallMethod('Login', Array, true) #7 [internal function]: Aurora\Modules\Core\Module->EntryApi() #8 /afterlogic-webmail-lite/system/Module/AbstractModule.php(620): call_user_func_array(Array, Array) #9 /afterlogic-webmail-lite/system/Module/Manager.php(690): Aurora\System\Module\AbstractModule->RunEntry('api') #10 /afterlogic-webmail-lite/system/Application.php(88): Aurora\System\Module\Manager->RunEntry('api') #11 /afterlogic-webmail-lite/index.php(21): Aurora\System\Application::Start() #12 {main} ```
Compatibility test ![](https://i.imgur.com/AbWH7Ow.png)
Mail server settings ![](https://i.imgur.com/geQd8Em.png)

Do you need more information ?

Here is my docker image : https://github.com/hardware/afterlogic-webmail-lite

afterlogic-support commented 6 years ago

Hello,

There's a couple of possibilities why this may happen. One of them is that domain name isn't found in the list of domains, and it has to be an exact match. The other one is that creating new users on first login is disabled, AutocreateMailAccountOnNewUserFirstLogin setting in data/settings/modules/Mail.config.json file controls that.

If none of that helps, we would need a test account on your installation, and admin area access, to help you further. You can send the credentials privately via HelpDesk.

hardware commented 6 years ago

I switched AutocreateMailAccountOnNewUserFirstLogin to true and, all works now, thank you :)

However, I'm not sure to understand, why is it necessary to create the account in webmail side while he already exists on the server side ? Why AutocreateMailAccountOnNewUserFirstLogin property isn't not set to true by default ?

This config item should be documented here I think.

afterlogic-support commented 6 years ago

Yes you're right, this setting supposed to be set to true, and I'm quite positive it's set that way by default. I've downloaded the latest package and it is set to true there. Did you originally install the product from a ZIP package available on website or in some other way - from Github repository, perhaps?

hardware commented 6 years ago

https://github.com/hardware/afterlogic-webmail-lite/blob/master/Dockerfile#L32

I use the link provided in your documentation :

https://afterlogic.org/download/webmail-lite-php-8.zip https://afterlogic.com/docs/webmail-lite-8/installation/installation-instructions

afterlogic-support commented 6 years ago

Strange really, yes it's the same package I've tested this with, and the configuration value is set to true there by default. Will make sure it stays that way in the future versions too. Thank you!

hardware commented 6 years ago

I found a local zip downloaded (July 16th) with the link above from the official website.

Here is the content :

# data/settings/modules/Mail.config.json

"AutocreateMailAccountOnNewUserFirstLogin": [
    true,
    "bool"
],
# modules/Mail/config.json

"AutocreateMailAccountOnNewUserFirstLogin": [
    false,
    "bool"
],
# pre-config.json

"Mail": {
    "AllowDefaultAccountForUser": true,
    "AutocreateMailAccountOnNewUserFirstLogin": true
},

I'm not sure how this can happens.

afterlogic-support commented 6 years ago

I've checked this with the developers, their guess is there was a manual edit of data/settings/modules/Mail.config.json file but the syntax in there wasn't valid and the file couldn't be parsed - and in such cases, modules/Mail/config.json file would be used as a backup.

hardware commented 6 years ago

That makes sense and I found the problem. As you know, I use my docker image to run your webmail, and by default, docker uses the data from the mount point /afterlogic-webmail-lite/data (which is an empty folder during the first start of the container), and delete all files in data folder, so data/settings/modules/* default config files can not used.

I will correct this problem on my side. Thank you for your quick help.