Skip to content

Commit d67df2c

Browse files
committed
[FEATURE] Configurable sender e-mail address for passwort change code
Refs #76 (cherry picked from commit 7c7ddf4)
1 parent 579cdd6 commit d67df2c

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

Classes/Service/FrontendUserService.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Derhansen\FeChangePwd\Exception\InvalidEmailAddressException;
1515
use Derhansen\FeChangePwd\Exception\InvalidUserException;
1616
use Derhansen\FeChangePwd\Exception\MissingPasswordHashServiceException;
17+
use Symfony\Component\Mime\Address;
1718
use TYPO3\CMS\Core\Context\Context;
1819
use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory;
1920
use TYPO3\CMS\Core\Database\ConnectionPool;
@@ -191,6 +192,13 @@ public function sendChangePasswordCodeEmail(array $settings, RequestInterface $r
191192
$email = GeneralUtility::makeInstance(FluidEmail::class);
192193
$email->setRequest($request);
193194
$email->setTemplate('ChangePasswordCode');
195+
196+
$senderEmail = $settings['requireChangePasswordCode']['senderEmail'] ?? false;
197+
$sendername = $settings['requireChangePasswordCode']['senderName'] ?? '';
198+
if ($senderEmail && GeneralUtility::validEmail($senderEmail)) {
199+
$email->from(new Address($senderEmail, $sendername));
200+
}
201+
194202
$email->to($recipientEmail);
195203
$email->format(FluidEmail::FORMAT_HTML);
196204
$email->assignMultiple([

Configuration/TypoScript/setup.typoscript

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ plugin.tx_fechangepwd {
3737
requireChangePasswordCode {
3838
enabled = 0
3939
validityInMinutes = 5
40+
senderEmail =
41+
senderName =
4042
}
4143

4244
# If enabled, the password for password breaches using the haveibeenpwned.com API

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ page with the Plugin of the extension
8585

8686
* `enabled` *(bool)* If set to `1`, the user must enter a change password code, which will be sent to the users email address, in order to set a new password. Default setting is `0`.
8787
* `validityInMinutes` *(integer)* The time in minutes the change password code is valid, when it has been requested by the user.
88+
* `senderEmail` *(string)* Sender email address for email send to user
89+
* `senderName` *(string)* Sender name for email sent to user
8890

8991
**plugin.tx_fechangepwd.settings.pwnedpasswordsCheck**
9092

0 commit comments

Comments
 (0)