Commit d8dbb1c2 authored by Thomas Löffler's avatar Thomas Löffler

Merge branch '415-send-information-mail-when-a-extension-key-was-transferred' into 'develop'

Resolve "Send information mail when a extension key was transferred"

Closes #415

See merge request !525
parents c251be92 41ce4006
Pipeline #9641 passed with stages
in 5 minutes and 27 seconds
......@@ -16,6 +16,7 @@ namespace T3o\TerFe2\Controller;
use ApacheSolrForTypo3\Solr\GarbageCollector;
use T3o\Ter\Api\ExtensionKey;
use T3o\TerFe2\Service\ExtkeyTransferMailService;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -178,6 +179,10 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr
// Is it possible to assign the key to a new user
if ($this->terConnection->assignExtensionKey($extension->getExtKey(), $newUser, $error)) {
$this->addFlashMessage($this->translate('registerkey.keyTransfered', [$extension->getExtKey(), $newUser]), '', \TYPO3\CMS\Core\Messaging\FlashMessage::OK);
// Send Email about the transfer
$extkeyTransferMailService = $this->objectManager->get(ExtkeyTransferMailService::class);
$extkeyTransferMailService->sendMail($newUser, $extension->getExtKey());
} else {
$this->addFlashMessage(
$this->resolveWSErrorMessage($error),
......
<?php
namespace T3o\TerFe2\Service;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Symfony\Component\Mime\Address;
use T3o\TerFe2\Domain\Model\FrontendUser;
use T3o\TerFe2\Domain\Repository\FrontendUserRepository;
use TYPO3\CMS\Core\Mail\FluidEmail;
use TYPO3\CMS\Core\Mail\Mailer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class ExtkeyTransferMailService
{
/**
* @var FrontendUserRepository
*/
protected $frontendUserRepository;
public function injectFrontendUserRepository(FrontendUserRepository $frontendUserRepository): void
{
$this->frontendUserRepository = $frontendUserRepository;
}
public function sendMail(string $username, string $extkey): void
{
/** @var FrontendUser $user */
$user = $this->frontendUserRepository->findOneByUsername($username);
$mail = GeneralUtility::makeInstance(FluidEmail::class);
$mail
->to(new Address($user->getEmail(), $user->getName()))
->subject('Extension Key "' . $extkey . '" was transferred to you!')
->format(FluidEmail::FORMAT_PLAIN)
->setTemplate('ExtensionKeyTransferMail')
->assignMultiple(
[
'name' => $user->getName(),
'extkey' => $extkey
]
);
GeneralUtility::makeInstance(Mailer::class)->send($mail);
}
}
Dear {name},
The extension with extension key: "{extkey}" has been transferred to you. If you think this is a mistake please
contact the TYPO3.org Team to help fixing the issue.
Best regards,
Your typo3.org maintenance team
--
This is an automatic message from the typo3.org system
Contact us: https://typo3.org/teams-committees/typo3org/ or just reply to this email
......@@ -21,7 +21,8 @@
"version": "0.5.0",
"require": {
"typo3/cms-core": "^9.5 || ^10.4",
"apache-solr-for-typo3/solr": "^10.0 || ^11.0"
"apache-solr-for-typo3/solr": "^10.0 || ^11.0",
"typo3/cms-fluid": "^9.5 || ^10.4"
},
"autoload": {
"psr-4": {
......
......@@ -51,3 +51,6 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\T3o\TerFe2\Task
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['ter_fe2:extension'] = 'EXT:ter_fe2/Classes/Controller/Eid/ExtensionController.php';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['VersionMapper'] = \T3o\TerFe2\Routing\Aspect\VersionMapper::class;
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['templateRootPaths'][789] = 'EXT:ter_fe2/Resources/Private/Templates/Mail';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['layoutRootPaths'][789] = 'EXT:ter_fe2/Resources/Private/Layouts';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment