From 9336b5bcb7cf2266cd0c95840454938bf71cdeb4 Mon Sep 17 00:00:00 2001 From: Michel Wohlert Date: Fri, 1 Dec 2017 23:28:32 +0100 Subject: [PATCH] Added Exception when trying to use mysql-crypt in PostgreSQL --- .../ChangePasswordPostfixAdminDriver.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php b/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php index 772db8ca8..761b9092e 100755 --- a/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php +++ b/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php @@ -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; }