8 parent::__construct(
'DisableOATHForUser',
'oathauth-disable-for-user' );
27 $form->setMessagePrefix(
'oathauth' );
28 $form->setWrapperLegend( $this->
msg(
'oathauth-disable-header' ) );
30 $form->
getOutput()->setPageTitle( $this->
msg(
'oathauth-disable-for-user' ) );
53 parent::checkExecutePermissions( $user );
63 parent::execute(
$par );
74 'label-message' =>
'oathauth-enteruser',
87 if ( $user && $user->getId() === 0 ) {
88 return [
'oathauth-user-not-found' ];
90 $oathUser = $this->OATHRepository->findByUser( $user );
92 if ( $oathUser->getKey() ===
null ) {
93 return [
'oathauth-user-not-does-not-have-oath-enabled' ];
96 if ( $this->
getUser()->pingLimiter(
'disableoath', 0 ) ) {
98 return [
'oathauth-throttled', Message::durationParam( 60 ) ];
101 $oathUser->setKey(
null );
102 $this->OATHRepository->remove( $oathUser, $this->
getRequest()->getIP() );
104 \MediaWiki\Logger\LoggerFactory::getInstance(
'authentication' )->info(
105 'OATHAuth disabled for {usertarget} by {user} from {clientip}', [
107 'usertarget' => $formData[
'user'],
116 $this->
getOutput()->addWikiMsg(
'oathauth-disabledoath' );
Special page which uses an HTMLForm to handle processing.
string null $par
The sub-page of the special page.
static getOATHUserRepository()
Get the singleton OATH user repository.
doesWrites()
Indicates whether this special page may perform database writes.
onSubmit(array $formData)
checkExecutePermissions(User $user)
Require users to be logged in.
alterForm(HTMLForm $form)
Set the page title and add JavaScript RL modules.
getLoginSecurityLevel()
Tells if the special page does something security-sensitive and needs extra defense against a stolen ...
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
OATHUserRepository $OATHRepository
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)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
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.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))