From 71fb7999f1f8a755fa4664033ebd0efcd405a9b3 Mon Sep 17 00:00:00 2001 From: Reedy Date: Thu, 11 Jan 2024 14:00:27 +0000 Subject: [PATCH] Fix a few remaining occurances of recovery token Bug: T354031 Follows-Up: Icf8626799615f8b95f380db9745e1447519b150a Change-Id: Ief577fb3e6adbf72b374d86df67529c46e4fe83e --- maintenance/UpdateTOTPScratchTokensToArray.php | 2 +- src/Api/Module/ApiOATHValidate.php | 2 +- src/Auth/TOTPSecondaryAuthenticationProvider.php | 2 +- src/HTMLForm/TOTPEnableForm.php | 4 ++-- src/Key/TOTPKey.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/maintenance/UpdateTOTPScratchTokensToArray.php b/maintenance/UpdateTOTPScratchTokensToArray.php index b7e52d08..282936fd 100644 --- a/maintenance/UpdateTOTPScratchTokensToArray.php +++ b/maintenance/UpdateTOTPScratchTokensToArray.php @@ -42,7 +42,7 @@ require_once "$IP/maintenance/Maintenance.php"; class UpdateTOTPScratchTokensToArray extends LoggedUpdateMaintenance { public function __construct() { parent::__construct(); - $this->addDescription( 'Script to update TOTP Recovery Tokens to an array' ); + $this->addDescription( 'Script to update TOTP Recovery Codes to an array' ); $this->requireExtension( 'OATHAuth' ); } diff --git a/src/Api/Module/ApiOATHValidate.php b/src/Api/Module/ApiOATHValidate.php index 6af861da..7fa72253 100644 --- a/src/Api/Module/ApiOATHValidate.php +++ b/src/Api/Module/ApiOATHValidate.php @@ -79,7 +79,7 @@ class ApiOATHValidate extends ApiBase { $user->pingLimiter( 'badoath' ); LoggerFactory::getInstance( 'authentication' )->info( - 'OATHAuth user {user} failed OTP/recovery token from {clientip}', + 'OATHAuth user {user} failed OTP token/recovery code from {clientip}', [ 'user' => $user, 'clientip' => $user->getRequest()->getIP(), diff --git a/src/Auth/TOTPSecondaryAuthenticationProvider.php b/src/Auth/TOTPSecondaryAuthenticationProvider.php index 87d4b1b3..7b56fef3 100644 --- a/src/Auth/TOTPSecondaryAuthenticationProvider.php +++ b/src/Auth/TOTPSecondaryAuthenticationProvider.php @@ -112,7 +112,7 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio // Increase rate limit counter for failed request $user->pingLimiter( 'badoath' ); - $this->logger->info( 'OATHAuth user {user} failed OTP/recovery token from {clientip}', [ + $this->logger->info( 'OATHAuth user {user} failed OTP token/recovery code from {clientip}', [ 'user' => $user->getName(), 'clientip' => $user->getRequest()->getIP(), ] ); diff --git a/src/HTMLForm/TOTPEnableForm.php b/src/HTMLForm/TOTPEnableForm.php index daee1a70..893b43fb 100644 --- a/src/HTMLForm/TOTPEnableForm.php +++ b/src/HTMLForm/TOTPEnableForm.php @@ -180,9 +180,9 @@ class TOTPEnableForm extends OATHAuthOOUIHTMLForm { } if ( $key->isScratchToken( $formData['token'] ) ) { - // A scratch/recovery token is not allowed for enrollment + // A recovery code is not allowed for enrollment LoggerFactory::getInstance( 'authentication' )->info( - 'OATHAuth {user} attempted to enable 2FA using a recovery token from {clientip}', [ + 'OATHAuth {user} attempted to enable 2FA using a recovery code from {clientip}', [ 'user' => $this->getUser()->getName(), 'clientip' => $this->getRequest()->getIP(), ] diff --git a/src/Key/TOTPKey.php b/src/Key/TOTPKey.php index 08abc90b..f1c264b3 100644 --- a/src/Key/TOTPKey.php +++ b/src/Key/TOTPKey.php @@ -184,7 +184,7 @@ class TOTPKey implements IAuthKey { // This is saved below via OATHUserRepository::persist array_splice( $this->recoveryCodes, $i, 1 ); - $logger->info( 'OATHAuth user {user} used a recovery token from {clientip}', [ + $logger->info( 'OATHAuth user {user} used a recovery token code {clientip}', [ 'user' => $user->getAccount(), 'clientip' => $clientIP, ] );