mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 15:08:28 +03:00
Modified the postfixadmin-change-password plugin to give users these additional options for MySQL:
* Specify the table name * Specify the column name for user names * Specify the column name for the passwords
This commit is contained in:
parent
91f3c05d5e
commit
ef5231decd
3 changed files with 60 additions and 2 deletions
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';
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue