Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| NoJsInfoField | |
0.00% |
0 / 10 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getInputOOUI | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| getInputHTML | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\OATHAuth\HTMLField; |
| 4 | |
| 5 | use MediaWiki\Html\Html; |
| 6 | use MediaWiki\HTMLForm\Field\HTMLInfoField; |
| 7 | use OOUI\HtmlSnippet; |
| 8 | use OOUI\MessageWidget; |
| 9 | |
| 10 | class NoJsInfoField extends HTMLInfoField { |
| 11 | |
| 12 | /** @inheritDoc */ |
| 13 | public function __construct( $info ) { |
| 14 | parent::__construct( $info ); |
| 15 | |
| 16 | $this->mClass .= ' webauthn-nojs'; |
| 17 | } |
| 18 | |
| 19 | /** @inheritDoc */ |
| 20 | public function getInputOOUI( $value ) { |
| 21 | // This style is used in our management forms |
| 22 | $this->mParent->getOutput()->addModuleStyles( 'ext.webauthn.ui.base.styles' ); |
| 23 | return new MessageWidget( [ |
| 24 | 'type' => 'error', |
| 25 | 'label' => new HtmlSnippet( wfMessage( 'oathauth-webauthn-javascript-required' )->parse() ), |
| 26 | ] ); |
| 27 | } |
| 28 | |
| 29 | /** @inheritDoc */ |
| 30 | public function getInputHTML( $value ) { |
| 31 | // This style is used in the MediaWiki auth forms |
| 32 | $this->mParent->getOutput()->addModuleStyles( 'ext.webauthn.ui.base.styles' ); |
| 33 | $this->mParent->getOutput()->addModuleStyles( 'mediawiki.codex.messagebox.styles' ); |
| 34 | return Html::errorBox( wfMessage( 'oathauth-webauthn-javascript-required' )->parse() ); |
| 35 | } |
| 36 | } |