ChangePassword extensions use \SnappyMail\SensitiveString

This commit is contained in:
the-djmaze 2024-03-17 14:50:32 +01:00
parent 9427b36633
commit 8c033f53fa
13 changed files with 70 additions and 56 deletions

View file

@ -1,6 +1,7 @@
<?php
use MailSo\Net\ConnectSettings;
use SnappyMail\SensitiveString;
class ChangePasswordHMailServerDriver
{
@ -37,7 +38,7 @@ class ChangePasswordHMailServerDriver
);
}
public function ChangePassword(\RainLoop\Model\Account $oAccount, string $sPrevPassword, string $sNewPassword) : bool
public function ChangePassword(\RainLoop\Model\Account $oAccount, SensitiveString $oPrevPassword, SensitiveString $oNewPassword) : bool
{
if (!\RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->oConfig->Get('plugin', 'hmailserver_emails', ''))) {
return false;
@ -62,7 +63,7 @@ class ChangePasswordHMailServerDriver
if ($oHmailDomain) {
$oHmailAccount = $oHmailDomain->Accounts->ItemByAddress($sEmail);
if ($oHmailAccount) {
$oHmailAccount->Password = $sNewPassword;
$oHmailAccount->Password = (string) $oNewPassword;
$oHmailAccount->Save();
$bResult = true;
} else {

View file

@ -1,14 +1,14 @@
<?php
use \RainLoop\Exceptions\ClientException;
use RainLoop\Exceptions\ClientException;
class ChangePasswordHMailServerPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Change Password hMailServer',
VERSION = '2.1',
RELEASE = '2024-03-12',
REQUIRED = '2.35.3',
VERSION = '2.36',
RELEASE = '2024-03-17',
REQUIRED = '2.36.0',
CATEGORY = 'Security',
DESCRIPTION = 'Extension to allow users to change their passwords through hMailServer';