Skip to content
Snippets Groups Projects

Feature upgrade to9 lts

Merged Kevin Ditscheid requested to merge feature_UpgradeTo9LTS into master
Compare and Show latest version
4 files
+ 84
4
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -36,11 +36,13 @@ use SGalinski\SgAccount\Domain\Repository\FrontendUserEmailRepository;
use SGalinski\SgAccount\Domain\Repository\FrontendUserGroupRepository;
use SGalinski\SgAccount\Domain\Repository\FrontendUserPasswordRepository;
use SGalinski\SgAccount\Domain\Repository\FrontendUserRepository;
use SGalinski\SgAccount\Exception\PasswordEncryptionFailedException;
use SGalinski\SgAccount\Service\AccountFormService;
use SGalinski\SgAccount\Service\GeneralService;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Resource\File as FalFile;
use TYPO3\CMS\Core\Resource\FileReference as FalFileReference;
use TYPO3\CMS\Core\Resource\Folder;
@@ -384,7 +386,17 @@ class FrontendUserService implements SingletonInterface {
);
// Encrypt plain password
$user->setPassword($this->accountFormService->encryptPassword($user->getPassword(), $this->settings));
try{
$user->setPassword($this->accountFormService->encryptPassword($user->getPassword(), $this->settings));
} catch(PasswordEncryptionFailedException $exception) {
// Password encryption failed, we need to log that somewhere, but it may not be a good idea to include the
// password in that message
GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__)->warning(
$exception->getMessage()
);
$user->setPassword('');
}
$this->frontendUserRepository->add($user);
@@ -520,7 +532,17 @@ class FrontendUserService implements SingletonInterface {
// Encrypt plain password
if ($user->_isDirty('password')) {
$user->setPassword($this->accountFormService->encryptPassword($user->getPassword(), $this->settings));
try {
$user->setPassword($this->accountFormService->encryptPassword($user->getPassword(), $this->settings));
} catch(PasswordEncryptionFailedException $exception) {
// Password encryption failed, we need to log that somewhere, but it may not be a good idea to include
// the password in that message
GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__)->warning(
$exception->getMessage()
);
$user->setPassword('');
}
}
$this->frontendUserRepository->update($user);
@@ -926,7 +948,15 @@ class FrontendUserService implements SingletonInterface {
// Encrypt plain password & set missing fields
$password = $userPassword->getPassword();
if ($password) {
$userPassword->setPassword($this->accountFormService->encryptPassword($password, $this->settings));
try {
$userPassword->setPassword($this->accountFormService->encryptPassword($password, $this->settings));
} catch(PasswordEncryptionFailedException $exception) {
// Password encryption failed, we need to log that somewhere, but it may not be a good idea to include
// the password in that message
GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__)->warning(
$exception->getMessage()
);
}
}
$userPassword->setForgotHash('');
$userPassword->setForgotHashDate(0);
Loading