mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 11:37:41 +03:00
Merge pull request #797 from zaffkea/master
Modified the postfixadmin-change-password plugin
This commit is contained in:
commit
fd20f10f21
3 changed files with 60 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -16,3 +16,4 @@
|
||||||
/build/dist
|
/build/dist
|
||||||
/build/tmp
|
/build/tmp
|
||||||
/data
|
/data
|
||||||
|
.DS_Store
|
||||||
|
|
|
||||||
50
plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php
Normal file → Executable file
50
plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php
Normal file → Executable file
|
|
@ -17,6 +17,21 @@ class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePass
|
||||||
*/
|
*/
|
||||||
private $sDatabase = 'postfixadmin';
|
private $sDatabase = 'postfixadmin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $sTable = 'mailbox';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $sUsercol = 'usercol';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $sPasscol = 'passcol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
@ -75,6 +90,39 @@ class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePass
|
||||||
return $this;
|
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
|
* @param string $sUser
|
||||||
*
|
*
|
||||||
|
|
@ -173,7 +221,7 @@ class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePass
|
||||||
$sUpdatePassword = $this->cryptPassword($sNewPassword, $oPdo);
|
$sUpdatePassword = $this->cryptPassword($sNewPassword, $oPdo);
|
||||||
if (0 < \strlen($sUpdatePassword))
|
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()));
|
$bResult = (bool) $oStmt->execute(array($sUpdatePassword, $oAccount->Email()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
9
plugins/postfixadmin-change-password/index.php
Normal file → Executable file
9
plugins/postfixadmin-change-password/index.php
Normal file → Executable file
|
|
@ -44,6 +44,9 @@ class PostfixAdminChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
->SetHost($this->Config()->Get('plugin', 'host', ''))
|
->SetHost($this->Config()->Get('plugin', 'host', ''))
|
||||||
->SetPort((int) $this->Config()->Get('plugin', 'port', 3306))
|
->SetPort((int) $this->Config()->Get('plugin', 'port', 3306))
|
||||||
->SetDatabase($this->Config()->Get('plugin', 'database', ''))
|
->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', ''))
|
->SetUser($this->Config()->Get('plugin', 'user', ''))
|
||||||
->SetPassword($this->Config()->Get('plugin', 'password', ''))
|
->SetPassword($this->Config()->Get('plugin', 'password', ''))
|
||||||
->SetEncrypt($this->Config()->Get('plugin', 'encrypt', ''))
|
->SetEncrypt($this->Config()->Get('plugin', 'encrypt', ''))
|
||||||
|
|
@ -68,6 +71,12 @@ class PostfixAdminChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
->SetDefaultValue(3306),
|
->SetDefaultValue(3306),
|
||||||
\RainLoop\Plugins\Property::NewInstance('database')->SetLabel('MySQL Database')
|
\RainLoop\Plugins\Property::NewInstance('database')->SetLabel('MySQL Database')
|
||||||
->SetDefaultValue('postfixadmin'),
|
->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')
|
\RainLoop\Plugins\Property::NewInstance('user')->SetLabel('MySQL User')
|
||||||
->SetDefaultValue('postfixadmin'),
|
->SetDefaultValue('postfixadmin'),
|
||||||
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('MySQL Password')
|
\RainLoop\Plugins\Property::NewInstance('password')->SetLabel('MySQL Password')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue