MediaWiki  1.34.0
TOTPExtendTokenField.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
11  protected $requests;
12 
16  protected $fieldInfo;
17 
21  protected $formDescriptor;
22 
26  protected $action;
27 
35  public static function callback( $requests, $fieldInfo, &$formDescriptor, $action ) {
36  $handler = new static(
37  $requests,
38  $fieldInfo,
40  $action
41  );
42 
43  return $handler->execute();
44  }
45 
53  $this->requests = $requests;
54  $this->fieldInfo = $fieldInfo;
55  $this->formDescriptor = &$formDescriptor;
56  $this->action = $action;
57  }
58 
59  protected function execute() {
60  if ( $this->shouldSkip() ) {
61  return true;
62  }
63 
64  $this->formDescriptor['OATHToken'] += [
65  'cssClass' => 'loginText',
66  'id' => 'wpOATHToken',
67  'size' => 20,
68  'dir' => 'ltr',
69  'autofocus' => true,
70  'persistent' => false,
71  'autocomplete' => false,
72  'spellcheck' => false,
73  ];
74  return true;
75  }
76 
77  protected function shouldSkip() {
78  return !isset( $this->fieldInfo['OATHToken'] );
79  }
80 }
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField
Definition: TOTPExtendTokenField.php:7
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField\callback
static callback( $requests, $fieldInfo, &$formDescriptor, $action)
Definition: TOTPExtendTokenField.php:35
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField\__construct
__construct( $requests, $fieldInfo, &$formDescriptor, $action)
Definition: TOTPExtendTokenField.php:52
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField\execute
execute()
Definition: TOTPExtendTokenField.php:59
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField\$action
string $action
Definition: TOTPExtendTokenField.php:26
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField\$requests
AuthenticationRequest[] $requests
Definition: TOTPExtendTokenField.php:11
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField\$fieldInfo
array $fieldInfo
Definition: TOTPExtendTokenField.php:16
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields
Definition: TOTPExtendTokenField.php:3
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField\shouldSkip
shouldSkip()
Definition: TOTPExtendTokenField.php:77
MediaWiki\Extension\OATHAuth\Hook\AuthChangeFormFields\TOTPExtendTokenField\$formDescriptor
array $formDescriptor
Definition: TOTPExtendTokenField.php:21
MediaWiki\Auth\AuthenticationRequest
This is a value object for authentication requests.
Definition: AuthenticationRequest.php:37