Added Exception when trying to use mysql-crypt in PostgreSQL

This commit is contained in:
Michel Wohlert 2017-12-01 23:28:32 +01:00
parent 09cdc285ab
commit 9336b5bcb7

View file

@ -317,14 +317,18 @@ class ChangePasswordPostfixAdminDriver implements \RainLoop\Providers\ChangePass
break;
case 'mysql_encrypt':
$oStmt = $oPdo->prepare('SELECT ENCRYPT(?) AS encpass');
if ($oStmt->execute(array($sPassword)))
{
$aFetchResult = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetchResult) && isset($aFetchResult[0]['encpass']))
if($this->sEngine == 'MySQL'){
$oStmt = $oPdo->prepare('SELECT ENCRYPT(?) AS encpass');
if ($oStmt->execute(array($sPassword)))
{
$sResult = $aFetchResult[0]['encpass'];
$aFetchResult = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
if (\is_array($aFetchResult) && isset($aFetchResult[0]['encpass']))
{
$sResult = $aFetchResult[0]['encpass'];
}
}
}else{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CouldNotSaveNewPassword);
}
break;
}