24 parent::__construct(
'DisableOATHForUser',
'oathauth-disable-for-user' );
46 $form->
getOutput()->setPageTitle( $this->
msg(
'oathauth-disable-for-user' ) );
69 parent::checkExecutePermissions( $user );
79 parent::execute(
$par );
90 'label-message' =>
'oathauth-enteruser',
97 'label-message' =>
'oathauth-enterreason',
112 if ( $user && $user->getId() === 0 ) {
113 return [
'oathauth-user-not-found' ];
115 $oathUser = $this->userRepo->findByUser( $user );
117 if ( !( $oathUser->getModule() instanceof
IModule ) ||
118 !$oathUser->getModule()->isEnabled( $oathUser ) ) {
119 return [
'oathauth-user-not-does-not-have-oath-enabled' ];
122 if ( $this->
getUser()->pingLimiter(
'disableoath', 0 ) ) {
127 $oathUser->disable();
128 $this->userRepo->remove( $oathUser, $this->
getRequest()->getIP() );
131 $logEntry->setPerformer( $this->
getUser() );
132 $logEntry->setTarget( $user->getUserPage() );
133 $logEntry->setComment( $formData[
'reason'] );
136 LoggerFactory::getInstance(
'authentication' )->info(
137 'OATHAuth disabled for {usertarget} by {user} from {clientip}', [
139 'usertarget' => $formData[
'user'],
148 $this->
getOutput()->addWikiMsg(
'oathauth-disabledoath' );
Exceptions for config failures.
Special page which uses an HTMLForm to handle processing.
string null $par
The sub-page of the special page.
Class for creating new log entries and inserting them into the database.
The Message class provides methods which fulfil two basic services:
static durationParam( $duration)
getName()
Get the name of this Special Page.
getOutput()
Get the OutputPage being used for this instance.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getUser()
Shortcut to get the User executing this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
Show an error when the user tries to do something whilst blocked.
Redirect a user to the login page.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.