From 0f026d7999451009b8a1a2f9677cca2fe2f95be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taavi=20V=C3=A4=C3=A4n=C3=A4nen?= Date: Thu, 4 Jan 2024 11:40:31 +0200 Subject: [PATCH] TOTPKey: Remove unused code Change-Id: I2d171823dc4c7c88b32872a6c3521af05b10ef39 --- src/Key/TOTPKey.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Key/TOTPKey.php b/src/Key/TOTPKey.php index f1c264b3..69b52d5f 100644 --- a/src/Key/TOTPKey.php +++ b/src/Key/TOTPKey.php @@ -25,8 +25,8 @@ use EmptyBagOStuff; use Exception; use jakobo\HOTP\HOTP; use MediaWiki\Extension\OATHAuth\IAuthKey; +use MediaWiki\Extension\OATHAuth\OATHAuthServices; use MediaWiki\Extension\OATHAuth\OATHUser; -use MediaWiki\Extension\OATHAuth\OATHUserRepository; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; use MWException; @@ -189,11 +189,7 @@ class TOTPKey implements IAuthKey { 'clientip' => $clientIP, ] ); - $moduleRegistry = MediaWikiServices::getInstance()->getService( 'OATHAuthModuleRegistry' ); - $module = $moduleRegistry->getModuleByKey( 'totp' ); - - /** @var OATHUserRepository $userRepo */ - $userRepo = MediaWikiServices::getInstance()->getService( 'OATHUserRepository' ); + $userRepo = OATHAuthServices::getInstance()->getUserRepository(); // TODO: support for multiple keys $user->setKeys( [ $this ] ); $userRepo->persist( $user, $clientIP );