Skip to content

Commit 6741352

Browse files
committed
[FEATURE] Make it possible to skip updating the lastSuccessfulAuthentication date via configuration of providerOptions
1 parent 1ef0dbe commit 6741352

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Classes/Authentication/UsernameHmacTimestampProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,13 @@ public function authenticate(TokenInterface $authenticationToken)
149149
}
150150

151151
if ($isHmacTokenValid) {
152-
$account->authenticationAttempted(TokenInterface::AUTHENTICATION_SUCCESSFUL);
152+
if (!isset($this->options['trackAuthenticationAttempts']) || $this->options['trackAuthenticationAttempts'] === true || $this->options['trackAuthenticationAttempts'] === 'successful') {
153+
$account->authenticationAttempted(TokenInterface::AUTHENTICATION_SUCCESSFUL);
154+
}
153155
$authenticationToken->setAuthenticationStatus(TokenInterface::AUTHENTICATION_SUCCESSFUL);
154156
$authenticationToken->setAccount($account);
157+
} else if (!isset($this->options['trackAuthenticationAttempts']) || $this->options['trackAuthenticationAttempts'] === true || $this->options['trackAuthenticationAttempts'] === 'failed') {
158+
$account->authenticationAttempted(TokenInterface::WRONG_CREDENTIALS);
155159
}
156160

157161
$this->accountRepository->update($account);

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Neos:
4040
providerOptions:
4141
# For an account with this authentication provider name will be searched:
4242
mainAuthenticationProviderName: 'My.Website:FrontendLoginProvider'
43+
# optionally only track failed authentication attempts (possible values: 'failed', 'successful', true)
44+
#trackAuthenticationAttempts: 'failed'
4345
entryPoint: 'WebRedirect'
4446
entryPointOptions:
4547
routeValues:

0 commit comments

Comments
 (0)