Skip to content

Commit

Permalink
[FEATURE] Configurable sender e-mail address for passwort change code
Browse files Browse the repository at this point in the history
Refs #76

(cherry picked from commit 7c7ddf4)
  • Loading branch information
derhansen committed Feb 2, 2024
1 parent 579cdd6 commit d67df2c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Classes/Service/FrontendUserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Derhansen\FeChangePwd\Exception\InvalidEmailAddressException;
use Derhansen\FeChangePwd\Exception\InvalidUserException;
use Derhansen\FeChangePwd\Exception\MissingPasswordHashServiceException;
use Symfony\Component\Mime\Address;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory;
use TYPO3\CMS\Core\Database\ConnectionPool;
Expand Down Expand Up @@ -191,6 +192,13 @@ public function sendChangePasswordCodeEmail(array $settings, RequestInterface $r
$email = GeneralUtility::makeInstance(FluidEmail::class);
$email->setRequest($request);
$email->setTemplate('ChangePasswordCode');

$senderEmail = $settings['requireChangePasswordCode']['senderEmail'] ?? false;
$sendername = $settings['requireChangePasswordCode']['senderName'] ?? '';
if ($senderEmail && GeneralUtility::validEmail($senderEmail)) {
$email->from(new Address($senderEmail, $sendername));
}

$email->to($recipientEmail);
$email->format(FluidEmail::FORMAT_HTML);
$email->assignMultiple([
Expand Down
2 changes: 2 additions & 0 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ plugin.tx_fechangepwd {
requireChangePasswordCode {
enabled = 0
validityInMinutes = 5
senderEmail =
senderName =
}

# If enabled, the password for password breaches using the haveibeenpwned.com API
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ page with the Plugin of the extension

* `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`.
* `validityInMinutes` *(integer)* The time in minutes the change password code is valid, when it has been requested by the user.
* `senderEmail` *(string)* Sender email address for email send to user
* `senderName` *(string)* Sender name for email sent to user

**plugin.tx_fechangepwd.settings.pwnedpasswordsCheck**

Expand Down

0 comments on commit d67df2c

Please sign in to comment.