Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 24 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| DisableForm | |
0.00% |
0 / 24 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| onSuccess | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDescriptors | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
6 | |||
| onSubmit | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\OATHAuth\HTMLForm; |
| 4 | |
| 5 | use MediaWiki\Message\Message; |
| 6 | |
| 7 | class DisableForm extends OATHAuthOOUIHTMLForm { |
| 8 | |
| 9 | /** @inheritDoc */ |
| 10 | public function onSuccess() { |
| 11 | $this->getOutput()->addWikiMsg( 'oathauth-disabledoath' ); |
| 12 | } |
| 13 | |
| 14 | /** @inheritDoc */ |
| 15 | protected function getDescriptors() { |
| 16 | $this->setSubmitTextMsg( 'oathauth-disable-generic' ); |
| 17 | $this->setSubmitDestructive(); |
| 18 | |
| 19 | $disableWarning = $this->msg( |
| 20 | 'oathauth-disable-method-warning', |
| 21 | $this->module->getDisplayName() |
| 22 | )->parseAsBlock(); |
| 23 | $customMessage = $this->module->getDisableWarningMessage(); |
| 24 | if ( $customMessage instanceof Message ) { |
| 25 | $disableWarning .= $customMessage->parseAsBlock(); |
| 26 | } |
| 27 | |
| 28 | return [ |
| 29 | 'warning' => [ |
| 30 | 'type' => 'info', |
| 31 | 'raw' => true, |
| 32 | 'default' => $disableWarning |
| 33 | ] |
| 34 | ]; |
| 35 | } |
| 36 | |
| 37 | /** @inheritDoc */ |
| 38 | public function onSubmit( array $formData ) { |
| 39 | $this->oathRepo->removeAllOfType( |
| 40 | $this->oathUser, |
| 41 | $this->module->getName(), |
| 42 | $this->getRequest()->getIP(), |
| 43 | true |
| 44 | ); |
| 45 | return true; |
| 46 | } |
| 47 | } |