Giter Site home page Giter Site logo

afterlogic / aurora-module-change-password-in-mail-server-database-plugin Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 1.0 48 KB

Allows users to change passwords on their email accounts, assuming the passwords are stored in a database table.

License: Other

PHP 84.60% Shell 15.40%

aurora-module-change-password-in-mail-server-database-plugin's People

Contributors

afterlogic-support avatar artemij-nemec avatar nadine-belanova avatar sash04ek avatar vasil-sokolov avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

may-han

aurora-module-change-password-in-mail-server-database-plugin's Issues

Make it work for multiple domain server

Dear devs,

thank you for this nice piece of software. We would like to try out afterlogic webmail-lite-8 on our multi-domain mailserver. As far as I can see it now, this module allows changing passwords if there are no duplicate usernames in the mysql database.
Could you please give me a hint on how to extract the domain from the currently logged-in user Account, to pass that to the sql command, too? I'm thinking of something like:

$sql = "UPDATE mailbox SET password='".$sPasshash."' WHERE username='".$oAccount->IncomingLogin."' AND domain='".$oAccount->Domain"'";

Though I could only see email in the API documentation. Or would I have to supply an external script (bash) and extract that domain information manually?

UI Error: Can't save new password

I managed to get this working, thanks to your help, but after getting the SQL query to work I still get this UI error:

webmail-error

The query is executed successfully, I can logout and login only with the new password. But the UI doesn't respond like expected, it leaves the "Change password" pop-up open and shows the mentioned error.

What I changed in Modules.php is:

$mysqlcon=mysqli_connect($config_dbhost, $config_dbuser, $config_dbpass, $config_dbname);
                        if($mysqlcon){
                                $sPasshash = exec("doveadm pw -s 'SHA512-CRYPT' -p '".$sPassword."'");
                                list($sLogin, $sDomainName) = explode('@', $oAccount->Email);
                                $sql = "UPDATE mailbox SET password = '".$sPasshash."' WHERE username = '".$sLogin."' AND domain = '".$sDomainName."'";
                                $bResult = mysqli_query($mysqlcon,$sql) or trigger_error(mysqli_error($mysqlcon)." ".$sql);
                                if (!$bResult){
                                        throw new \Aurora\System\Exceptions\ApiException(\Aurora\System\Exceptions\Errs::UserManager_AccountNewPasswordUpdateError);
                                }
                                mysqli_close($mysqlcon);

In the HTTP POST answer I see:

{"AuthenticatedUserId":4,"@Time":0.09297513961791992,"Module":"Mail","Method":"ChangePassword","Result":false,"SubscriptionsResult":null}

the logs just show:

[21:38:17.82][60c25724] API: Mail::ChangePassword^M
[21:38:17.82][60c25724] Execute subscription: ChangePasswordInMailServerDatabasePlugin::onBeforeChangePassword^M
[21:38:17.87][60c25724] Execute subscription: Core::onAfterChangePassword^M

I guess this is not the intended behaviour, how can I help debug this further?

Change Password: error code 500

Dear devs,

we are running the newest version of webmail-lite 8 8.3.16 and are seeing the following error when trying to change passwords using this module:

2020/03/04 11:35:55 [error] 14052#14052: *4447 FastCGI sent in stderr: "PHP message: PHP Recoverable fatal error:  Object of class Aurora\Modules\Mail\Classes\Account could not be converted to string in /var/www/webmail-lite/modules/Mail/Module.php on line 5358" while reading response header from upstream, client: xx.xx.xx.xx, server: mail.example.com, request: "POST /?/Api/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "mail.example.com"

I'd be happy to help debugging this further.

Kind regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.