diff --git a/.gitignore b/.gitignore index b9a13560a..3cc27256d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ /build/local /build/dist /build/tmp -/data \ No newline at end of file +/data +.DS_Store diff --git a/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php b/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php old mode 100644 new mode 100755 index ccd1dbf8a..019bdde0d --- a/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php +++ b/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php @@ -17,6 +17,21 @@ class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePass */ private $sDatabase = 'postfixadmin'; + /** + * @var string + */ + private $sTable = 'mailbox'; + + /** + * @var string + */ + private $sUsercol = 'usercol'; + + /** + * @var string + */ + private $sPasscol = 'passcol'; + /** * @var string */ @@ -75,6 +90,39 @@ class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePass return $this; } + /** + * @param string $sTable + * + * @return \ChangePasswordPostfixAdminDriver + */ + public function SetTable($sTable) + { + $this->sTable = $sTable; + return $this; + } + + /** + * @param string $sUsercol + * + * @return \ChangePasswordPostfixAdminDriver + */ + public function SetUserColumn($sUsercol) + { + $this->sUsercol = $sUsercol; + return $this; + } + + /** + * @param string $sPasscol + * + * @return \ChangePasswordPostfixAdminDriver + */ + public function SetPasswordColumn($sPasscol) + { + $this->sPasscol = $sPasscol; + return $this; + } + /** * @param string $sUser * @@ -173,7 +221,7 @@ class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePass $sUpdatePassword = $this->cryptPassword($sNewPassword, $oPdo); if (0 < \strlen($sUpdatePassword)) { - $oStmt = $oPdo->prepare('UPDATE mailbox SET password = ? WHERE username = ?'); + $oStmt = $oPdo->prepare("UPDATE $this->sTable SET $this->sPasscol = ? WHERE $this->sUsercol = ?"); $bResult = (bool) $oStmt->execute(array($sUpdatePassword, $oAccount->Email())); } else diff --git a/plugins/postfixadmin-change-password/index.php b/plugins/postfixadmin-change-password/index.php old mode 100644 new mode 100755 index bf3fee467..a360efa08 --- a/plugins/postfixadmin-change-password/index.php +++ b/plugins/postfixadmin-change-password/index.php @@ -44,6 +44,9 @@ class PostfixAdminChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin ->SetHost($this->Config()->Get('plugin', 'host', '')) ->SetPort((int) $this->Config()->Get('plugin', 'port', 3306)) ->SetDatabase($this->Config()->Get('plugin', 'database', '')) + ->SetTable($this->Config()->Get('plugin', 'table', '')) + ->SetUserColumn($this->Config()->Get('plugin', 'usercol', '')) + ->SetPasswordColumn($this->Config()->Get('plugin', 'passcol', '')) ->SetUser($this->Config()->Get('plugin', 'user', '')) ->SetPassword($this->Config()->Get('plugin', 'password', '')) ->SetEncrypt($this->Config()->Get('plugin', 'encrypt', '')) @@ -68,6 +71,12 @@ class PostfixAdminChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin ->SetDefaultValue(3306), \RainLoop\Plugins\Property::NewInstance('database')->SetLabel('MySQL Database') ->SetDefaultValue('postfixadmin'), + \RainLoop\Plugins\Property::NewInstance('table')->SetLabel('MySQL table') + ->SetDefaultValue('mailbox'), + \RainLoop\Plugins\Property::NewInstance('usercol')->SetLabel('MySQL username column') + ->SetDefaultValue('username'), + \RainLoop\Plugins\Property::NewInstance('passcol')->SetLabel('MySQL password column') + ->SetDefaultValue('password'), \RainLoop\Plugins\Property::NewInstance('user')->SetLabel('MySQL User') ->SetDefaultValue('postfixadmin'), \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('MySQL Password')