Skip to content

Commit

Permalink
[BUGFIX] Reset UriBuilder for links generated by PasswordRecoveryService
Browse files Browse the repository at this point in the history
The `EXT:felogin/Classes/Service/RecoveryService.php` makes use of
the local $uriBuilder instance building links, however it does
not `reset()` it's state before building a URL.

It seems this only creates an issue when used in conjunction with
`EXT:vhs` (possibly due to adapted fluid/object caching behavior?).

Fixing this by resetting the instance as recommended via
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/Extbase/Reference/UriBuilder.html
should take care of this, even though uriBuilder should be a
singleton only operating within the scope of a single
ActionController.

Resolves: #102203
Releases: main, 12.4, 11.5
Change-Id: Idb6089c4b43b6d3352fbbbbeedfa63770959def0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81589
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
  • Loading branch information
fe-hicking authored and lolli42 committed Oct 26, 2023
1 parent b942bc0 commit 3878632
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion typo3/sysext/felogin/Classes/Service/RecoveryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ protected function getReceiverName(array $userInformation): string
*/
protected function prepareMail(Address $receiver, string $hash): Email
{
$url = $this->uriBuilder->setCreateAbsoluteUri(true)
$url = $this->uriBuilder
->reset()
->setCreateAbsoluteUri(true)
->uriFor(
'showChangePassword',
['hash' => $hash],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function sendRecoveryEmailShouldGenerateMailFromConfiguration(
$languageService->sL(Argument::containingString('password_recovery_mail_header'))->willReturn('translation');

$uriBuilder = $this->prophesize(UriBuilder::class);
$uriBuilder->reset()->willReturn($uriBuilder->reveal());
$uriBuilder->setCreateAbsoluteUri(true)->willReturn($uriBuilder->reveal());
$uriBuilder->uriFor(
'showChangePassword',
Expand Down

0 comments on commit 3878632

Please sign in to comment.