mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-24 00:05:24 +00:00
Replace more users of getModule() for enabled checks
Bug: T242031 Change-Id: I602b5c0cf36096a7fc41116874e776277bf6f833
This commit is contained in:
parent
4fee32d2f3
commit
1df74c2e2b
|
@ -101,7 +101,7 @@ class HookHandler implements
|
|||
// If there is no existing module for the user, and the user is not allowed to enable it,
|
||||
// we have nothing to show.
|
||||
if (
|
||||
$oathUser->getModule() === null &&
|
||||
!$oathUser->isTwoFactorAuthEnabled() &&
|
||||
!$this->permissionManager->userHasRight( $user, 'oathauth-enable' )
|
||||
) {
|
||||
return true;
|
||||
|
@ -182,7 +182,7 @@ class HookHandler implements
|
|||
}
|
||||
|
||||
$oathUser = $this->userRepo->findByUser( $user );
|
||||
if ( $oathUser->getModule() === null ) {
|
||||
if ( !$oathUser->isTwoFactorAuthEnabled() ) {
|
||||
// Not enabled, strip the groups
|
||||
return $intersect;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ use ConfigException;
|
|||
use FormSpecialPage;
|
||||
use HTMLForm;
|
||||
use ManualLogEntry;
|
||||
use MediaWiki\Extension\OATHAuth\IModule;
|
||||
use MediaWiki\Extension\OATHAuth\OATHUserRepository;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\User\UserFactory;
|
||||
|
@ -119,14 +118,9 @@ class VerifyOATHForUser extends FormSpecialPage {
|
|||
}
|
||||
$oathUser = $this->userRepo->findByUser( $user );
|
||||
|
||||
if ( !( $oathUser->getModule() instanceof IModule ) ||
|
||||
!$oathUser->getModule()->isEnabled( $oathUser ) ) {
|
||||
$result = self::OATHAUTH_NOT_ENABLED;
|
||||
} else {
|
||||
$result = self::OATHAUTH_IS_ENABLED;
|
||||
}
|
||||
|
||||
$this->enabledStatus = $result;
|
||||
$this->enabledStatus = $oathUser->isTwoFactorAuthEnabled()
|
||||
? self::OATHAUTH_IS_ENABLED
|
||||
: self::OATHAUTH_NOT_ENABLED;
|
||||
|
||||
// message used: logentry-oath-verify
|
||||
$logEntry = new ManualLogEntry( 'oath', 'verify' );
|
||||
|
|
Loading…
Reference in a new issue