MediaWiki  1.34.0
MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm Class Reference
Inheritance diagram for MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm:
Collaboration diagram for MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm:

Public Member Functions

 getHTML ( $submitResult)
 
 onSubmit (array $formData)
 
 onSuccess ()
 Add content to output when operation was successful. More...
 
- Public Member Functions inherited from MediaWiki\Extension\OATHAuth\HTMLForm\OATHAuthOOUIHTMLForm
 __construct (OATHUser $oathUser, OATHUserRepository $oathRepo, IModule $module)
 Initialize the form. More...
 
 displayForm ( $submitResult)
 Display the form (sending to the context's OutputPage object), with an appropriate error message or stack of messages, and any validation errors, etc.
Warning
You should call prepareForm() before calling this function. Moreover, when doing method chaining this should be the very last method call just after prepareForm().
Parameters
bool | string | array | Status$submitResultOutput from HTMLForm::trySubmit()
Returns
void Nothing, should be last call
More...
 
 show ( $layout=null)
 
Parameters
Layout | null$layout
Returns
bool|Status
More...
 
- Public Member Functions inherited from OOUIHTMLForm
 __construct ( $descriptor, $context=null, $messagePrefix='')
 Build a new HTMLForm from an array of field attributes. More...
 
 getBody ()
 Get the whole body of the form. More...
 
 getButtons ()
 Get the submit and (potentially) reset buttons. More...
 
 getErrorsOrWarnings ( $elements, $elementsType)
 
 getHeaderText ( $section=null)
 Get header text. More...
 
 wrapForm ( $html)
 Wrap the form innards in an actual "<form>" element. More...
 
- Public Member Functions inherited from HTMLForm
 addButton ( $data)
 Add a button to the form. More...
 
 addFields ( $descriptor)
 Add fields to the form. More...
 
 addFooterText ( $msg, $section=null)
 Add footer text, inside the form. More...
 
 addHeaderText ( $msg, $section=null)
 Add HTML to the header, inside the form. More...
 
 addHiddenField ( $name, $value, array $attribs=[])
 Add a hidden field to the output. More...
 
 addHiddenFields (array $fields)
 Add an array of hidden fields to the output. More...
 
 addPostText ( $msg)
 Add text to the end of the display. More...
 
 addPreText ( $msg)
 Add HTML to introductory message. More...
 
 displaySection ( $fields, $sectionName='', $fieldsetIDPrefix='', &$hasUserVisibleFields=false)
 
 filterDataForSubmit ( $data)
 Overload this if you want to apply special filtration routines to the form as a whole, after it's submitted but before it's processed. More...
 
 formatErrors ( $errors)
 Format a stack of error messages into a single HTML string. More...
 
 getAction ()
 Get the value for the action attribute of the form. More...
 
 getDisplayFormat ()
 Getter for displayFormat. More...
 
 getField ( $fieldname)
 
 getFooterText ( $section=null)
 Get footer text. More...
 
 getHiddenFields ()
 Get the hidden fields that should go inside the form. More...
 
 getLegend ( $key)
 Get a string to go in the "<legend>" of a section fieldset. More...
 
 getMethod ()
 
 getPreText ()
 Get the introductory message HTML. More...
 
 getSubmitText ()
 Get the text for the submit button, either customised or a default. More...
 
 getTitle ()
 Get the title. More...
 
 hasField ( $fieldname)
 
 loadData ()
 Construct the form fields from the Descriptor array. More...
 
 needsJSForHtml5FormValidation ()
 Whether this form, with its current fields, requires the user agent to have JavaScript enabled for the client-side HTML5 form validation to work correctly. More...
 
 prepareForm ()
 Prepare form for submission. More...
 
 setAction ( $action)
 Set the value for the action attribute of the form. More...
 
 setAutocomplete ( $autocomplete)
 Set the value for the autocomplete attribute of the form. More...
 
 setCancelTarget ( $target)
 Sets the target where the user is redirected to after clicking cancel. More...
 
 setCollapsibleOptions ( $collapsedByDefault=false)
 Enable collapsible mode, and set whether the form is collapsed by default. More...
 
 setDisplayFormat ( $format)
 Set format in which to display the form. More...
 
 setFooterText ( $msg, $section=null)
 Set footer text, inside the form. More...
 
 setFormIdentifier ( $ident)
 Set an internal identifier for this form. More...
 
 setHeaderText ( $msg, $section=null)
 Set header text, inside the form. More...
 
 setId ( $id)
 
 setIntro ( $msg)
 Set the introductory message, overwriting any existing message. More...
 
 setMessagePrefix ( $p)
 Set the prefix for various default messages. More...
 
 setMethod ( $method='post')
 Set the method used to submit the form. More...
 
 setName ( $name)
 
 setPostText ( $msg)
 Set text at the end of the display. More...
 
 setPreText ( $msg)
 Set the introductory message HTML, overwriting any existing message. More...
 
 setSubmitCallback ( $cb)
 Set a callback to a function to do something with the form once it's been successfully validated. More...
 
 setSubmitDestructive ()
 Identify that the submit button in the form has a destructive action. More...
 
 setSubmitID ( $t)
 Set the id for the submit button. More...
 
 setSubmitName ( $name)
 
 setSubmitText ( $t)
 Set the text for the submit button. More...
 
 setSubmitTextMsg ( $msg)
 Set the text for the submit button to a message. More...
 
 setSubmitTooltip ( $name)
 
 setTableId ( $id)
 Set the id of the \<table\> or outermost \<div\> element. More...
 
 setTitle ( $t)
 Set the title for form submission. More...
 
 setTokenSalt ( $salt)
 Set the salt for the edit token. More...
 
 setValidationErrorMessage ( $msg)
 Set a message to display on a validation error. More...
 
 setWrapperAttributes ( $attributes)
 For internal use only. More...
 
 setWrapperLegend ( $legend)
 Prompt the whole form to be wrapped in a "<fieldset>", with this text as its "<legend>" element. More...
 
 setWrapperLegendMsg ( $msg)
 Prompt the whole form to be wrapped in a "<fieldset>", with this message as its "<legend>" element. More...
 
 show ()
 The here's-one-I-made-earlier option: do the submission if posted, or display the form with or without funky validation errors. More...
 
 showAlways ()
 Same as self::show with the difference, that the form will be added to the output, no matter, if the validation was good or not. More...
 
 showCancel ( $show=true)
 Show a cancel button (or prevent it). More...
 
 suppressDefaultSubmit ( $suppressSubmit=true)
 Stop a default submit button being shown for this form. More...
 
 suppressReset ( $suppressReset=true)
 Stop a reset button being shown for this form. More...
 
 tryAuthorizedSubmit ()
 Try submitting, with edit token check first. More...
 
 trySubmit ()
 Validate all the fields, and call the submission callback function if everything is kosher. More...
 
 wasSubmitted ()
 Test whether the form was considered to have been submitted or not, i.e. More...
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object. More...
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getUser ()
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 
- Public Member Functions inherited from MediaWiki\Extension\OATHAuth\HTMLForm\IManageForm
 addHiddenField ( $name, $value, array $attribs=[])
 
 hasField ( $fieldname)
 
 setSubmitCallback ( $cb)
 
 setTitle ( $t)
 

Protected Member Functions

 getDescriptors ()
 
 getScratchTokensForDisplay (TOTPKey $key)
 Retrieve current scratch tokens for display purposes. More...
 
 getSecretForDisplay (TOTPKey $key)
 Retrieve the current secret for display purposes. More...
 
- Protected Member Functions inherited from MediaWiki\Extension\OATHAuth\HTMLForm\OATHAuthOOUIHTMLForm
 wrapFieldSetSection ( $legend, $section, $attributes, $isRoot)
 Wraps the given $section into an user-visible fieldset.
Parameters
string$legendLegend text for the fieldset
string$sectionThe section content in plain Html
array$attributesAdditional attributes for the fieldset
bool$isRootSection is at the root of the tree
Returns
string The fieldset's Html
Returns
OOUI\PanelLayout
More...
 
- Protected Member Functions inherited from OOUIHTMLForm
 formatSection (array $fieldsHtml, $sectionName, $anyFieldHasLabel)
 Put a form section together from the individual fields' HTML, merging it and wrapping. More...
 
- Protected Member Functions inherited from HTMLForm
 getFormAttributes ()
 Get HTML attributes for the <form> tag. More...
 
 getMessage ( $value)
 Turns a *-message parameter (which could be a MessageSpecifier, or a message name, or a name + parameters array) into a Message. More...
 

Private Member Functions

 createResourceList ( $resources)
 
 tokenFormatterFunction ( $token)
 Formats a key or scratch token by creating groups of 4 separated by space characters. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OOUIHTMLForm
static loadInputFromParameters ( $fieldname, $descriptor, HTMLForm $parent=null)
 Initialise a new Object for the field. More...
 
- Static Public Member Functions inherited from HTMLForm
static factory ( $displayFormat,... $arguments)
 Construct a HTMLForm object for given display type. More...
 
static getClassFromDescriptor ( $fieldname, &$descriptor)
 Get the HTMLFormField subclass for this descriptor. More...
 
- Public Attributes inherited from HTMLForm
 $mFieldData
 
- Static Public Attributes inherited from HTMLForm
static $typeMappings
 
- Protected Attributes inherited from MediaWiki\Extension\OATHAuth\HTMLForm\OATHAuthOOUIHTMLForm
Layout null $layoutContainer = null
 
LoggerInterface $logger
 
IModule $module
 
OATHUserRepository $oathRepo
 
OATHUser $oathUser
 
bool $panelFramed = true
 Make the form-wrapper panel framed. More...
 
bool $panelPadded = true
 Make the form-wrapper panel padded. More...
 
- Protected Attributes inherited from OOUIHTMLForm
string $displayFormat = 'ooui'
 Symbolic display format name. More...
 
- Protected Attributes inherited from HTMLForm
array $availableDisplayFormats
 Available formats in which to display the form. More...
 
array $availableSubclassDisplayFormats
 Available formats in which to display the form. More...
 
string $displayFormat = 'table'
 Format in which to display form. More...
 
bool string $mAction = false
 Form action URL. More...
 
string null $mAutocomplete = null
 Form attribute autocomplete. More...
 
array[] $mButtons = []
 -var array<array{name:string,value:string,label-message?:string,label?:string,label-raw?:string,id?:string,attribs?:array,flags?:string|string[],framed?:bool}> More...
 
 $mCancelTarget
 
bool $mCollapsed = false
 Whether the form is collapsed by default. More...
 
bool $mCollapsible = false
 Whether the form can be collapsed. More...
 
 $mFieldTree = []
 
HTMLFormField[] $mFlatFields = []
 
 $mFooter = ''
 
 $mFormIdentifier
 
 $mHeader = ''
 
 $mHiddenFields = []
 
 $mId
 
 $mMessagePrefix
 
 $mMethod = 'post'
 
 $mName
 
 $mPost = ''
 
 $mPre = ''
 
 $mSectionFooters = []
 
 $mSectionHeaders = []
 
 $mShowCancel = false
 
 $mShowReset = false
 
 $mShowSubmit = true
 
 $mSubmitCallback
 
string[] $mSubmitFlags = [ 'primary', 'progressive' ]
 
 $mSubmitID
 
 $mSubmitName
 
 $mSubmitText
 
 $mSubmitTooltip
 
 $mSubSectionBeforeFields = true
 If true, sections that contain both fields and subsections will render their subsections before their fields. More...
 
 $mTableId = ''
 
 $mTitle
 
string array $mTokenSalt = ''
 Salt for the edit token. More...
 
 $mUseMultipart = false
 
 $mValidationErrorMessage
 
 $mWasSubmitted = false
 
 $mWrapperAttributes = []
 
 $mWrapperLegend = false
 

Detailed Description

Definition at line 10 of file TOTPEnableForm.php.

Member Function Documentation

◆ createResourceList()

MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm::createResourceList (   $resources)
private
Parameters
$resourcesarray
Returns
string

Definition at line 106 of file TOTPEnableForm.php.

Referenced by MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getDescriptors().

◆ getDescriptors()

◆ getHTML()

MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm::getHTML (   $submitResult)
Parameters
array | bool | Status | string$submitResult
Returns
string

Reimplemented from HTMLForm.

Definition at line 15 of file TOTPEnableForm.php.

References ContextSource\getOutput().

◆ getScratchTokensForDisplay()

MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm::getScratchTokensForDisplay ( TOTPKey  $key)
protected

Retrieve current scratch tokens for display purposes.

The characters of the token are split in groups of 4

Parameters
TOTPKey$key
Returns
string[]

Definition at line 134 of file TOTPEnableForm.php.

References MediaWiki\Extension\OATHAuth\Key\TOTPKey\getScratchTokens().

Referenced by MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getDescriptors().

◆ getSecretForDisplay()

MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm::getSecretForDisplay ( TOTPKey  $key)
protected

Retrieve the current secret for display purposes.

The characters of the token are split in groups of 4

Parameters
TOTPKey$key
Returns
String

Definition at line 122 of file TOTPEnableForm.php.

References MediaWiki\Extension\OATHAuth\Key\TOTPKey\getSecret(), and MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\tokenFormatterFunction().

Referenced by MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getDescriptors().

◆ onSubmit()

MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm::onSubmit ( array  $formData)

◆ onSuccess()

MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm::onSuccess ( )

Add content to output when operation was successful.

Implements MediaWiki\Extension\OATHAuth\HTMLForm\IManageForm.

Definition at line 25 of file TOTPEnableForm.php.

References ContextSource\getOutput().

◆ tokenFormatterFunction()

MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm::tokenFormatterFunction (   $token)
private

Formats a key or scratch token by creating groups of 4 separated by space characters.

Parameters
string$tokenToken to format
Returns
string The token formatted for display

Definition at line 144 of file TOTPEnableForm.php.

Referenced by MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm\getSecretForDisplay().


The documentation for this class was generated from the following file: