Skip to content

Commit

Permalink
[TASK] Drop autologout for no-longer-supported onetimeaccount logins (#…
Browse files Browse the repository at this point in the history
…3556)

As we no longer support real FE logins with the onetimeaccount extension,
we no longer need the outologout.
  • Loading branch information
oliverklee committed Sep 16, 2024
1 parent bcc7956 commit 8af5814
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 75 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Removed

- Drop the autologout for no-longer-supported onetimeaccount logins (#3556)
- Drop `$isFileName` parameter in `::getConfValueString()` (#2835)
- Remove the `omitDateIfSameAsPrevious` setting (#2314)
- Drop `SeparateBillingAddressUpgradeWizard` (#3496)
Expand Down
19 changes: 2 additions & 17 deletions Classes/Service/OneTimeAccountConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ public function __construct()
$this->frontEndUserAuthentication = $frontEndUserAuthentication;
}

/**
* Checks whether a login session is active, and that is has been created by the "onetimeaccount" extension.
*/
public function existsOneTimeAccountLoginSession(): bool
{
return $this->frontEndUserAuthentication->getKey('user', 'onetimeaccount') === true;
}

/**
* Returns the user UID of a FE user created by the "onetimeaccount" extension (without a FE login session).
*
Expand All @@ -59,19 +51,12 @@ public function getOneTimeAccountUserUid(): ?int
}

/**
* Destroys any onetimeaccount sessions (with or without login).
*
* If a onetimeaccount login session is active, the user will be logged out.
* Destroys any onetimeaccount sessions (without login).
*
* If no user is logged in, but a onetimeaccount user UID is available in the session, it will be deleted.
*
* If regular FE user is logged in, nothing happens.
* If a onetimeaccount user UID is available in the session, it will be deleted.
*/
public function destroyOneTimeSession(): void
{
if ($this->existsOneTimeAccountLoginSession()) {
$this->frontEndUserAuthentication->logoff();
}
if (\is_int($this->getOneTimeAccountUserUid())) {
$this->frontEndUserAuthentication->setAndSaveSessionData('onetimeaccountUserUid', null);
}
Expand Down
58 changes: 0 additions & 58 deletions Tests/Unit/Service/OneTimeAccountConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,6 @@ public function isSingleton(): void
self::assertInstanceOf(SingletonInterface::class, $this->subject);
}

/**
* @test
*/
public function existsOneTimeAccountLoginSessionForNoSessionDataReturnsFalse(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(null);

self::assertFalse($this->subject->existsOneTimeAccountLoginSession());
}

/**
* @test
*/
public function existsOneTimeAccountLoginSessionForSessionDataReturnsTrue(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(true);

self::assertTrue($this->subject->existsOneTimeAccountLoginSession());
}

/**
* @test
*/
Expand Down Expand Up @@ -143,18 +123,6 @@ public function getOneTimeAccountUserUidForPositiveUserUidReturnsUserUid(): void
self::assertSame($userUid, $this->subject->getOneTimeAccountUserUid());
}

/**
* @test
*/
public function destroyOneTimeSessionForRegularLoginDoesNotLogUserOut(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(null);

$this->frontEndUserAuthenticationMock->expects(self::never())->method('logoff');

$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
Expand All @@ -167,18 +135,6 @@ public function destroyOneTimeSessionForRegularLoginDoesSetAnySessionDate(): voi
$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
public function destroyOneTimeSessionForOneTimeLoginLogsUserOut(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(true);

$this->frontEndUserAuthenticationMock->expects(self::once())->method('logoff');

$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
Expand All @@ -194,20 +150,6 @@ public function destroyOneTimeSessionForOneTimeSessionWithoutLoginRemovesUserUid
$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
public function destroyOneTimeSessionForRegularLoginAndOneTimeSessionDoesNotLogUserOut(): void
{
$this->frontEndUserAuthenticationMock->method('getKey')->with('user', 'onetimeaccount')->willReturn(null);
$this->frontEndUserAuthenticationMock->method('getSessionData')->with('onetimeaccountUserUid')
->willReturn(5);

$this->frontEndUserAuthenticationMock->expects(self::never())->method('logoff');

$this->subject->destroyOneTimeSession();
}

/**
* @test
*/
Expand Down

0 comments on commit 8af5814

Please sign in to comment.