Located in file /wire/core/Tfa.php

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Tfa class also inherits all the methods and properties of: WireData and Wire.

Show class?             Show args?        

Common

NameReturnSummary 
Tfa::active()
boolReturns true if a TFA process is currently active 
Tfa::autoEnableSupported()
boolDoes this TFA module support automatic enable? 
Tfa::autoEnableUser(User $user)
(nothing)Auto-enable this TFA module for given $user 
Tfa::autoRoleIDs array Role IDs to enforce $autoType or blank for all roles, applies only if $autoType set (default=[]) 
Tfa::autoType string Automatic/force TFA type (module name) to use when user doesn’t already have TFA enabled (default='') 
Tfa::buildAuthCodeForm()
InputfieldFormBuild the form used for two-factor authentication
Tfa::cancelLabel string Label to use for Cancel link (default='Cancel', translatable) 
Tfa::cancelMarkup string Markup to use for the cancel link that appears under auth code form, must have {url} and {label} placeholders. 
Tfa::codeExpire int Codes expire after this many seconds (default=180) 
Tfa::codeLength int Required length for authentication code (default=6) 
Tfa::codeType int Type of TFA code to use, see codeType constants (default=0, which is Tfa::codeTypeDigits) 
Tfa::configureLabel string Indicates that TFA needs to be configured 
Tfa::enabledDescLabel string Describes enabled TFA and how to change settings 
Tfa::enabledLabel string Indicates TFA enabled 
Tfa::expiredCodeLabel string Expired code error 
Tfa::fieldTfaTypeDescLabel string Description of 2-factor auth type 
Tfa::fieldTfaTypeLabel string Select 2-factor auth type 
Tfa::formAttrs array Form <form> element attributes 
Tfa::getModule()
Tfa nullGet the TFA module for given user or current session 
Tfa::getModuleConfigInputfields(InputfieldWrapper $inputfields)
(nothing)Module configuration 
Tfa::getTfaTypeName()
stringGet translated Tfa type name (short name) 
Tfa::getTfaTypeSummary()
stringGet translated Tfa type summary 
Tfa::getTfaTypeTitle()
stringGet translated Tfa type title (longer name) 
Tfa::getUser()
UserGet current user for TFA 
Tfa::getUserEnabledInputfields(User $user, InputfieldWrapper $fieldset, array $settings)
(nothing)Get fields for when user already has TFA enabled
Tfa::getUserSettings(User $user)
arrayGet TFA data for given user from user_tfa field 
Tfa::getUserSettingsInputfields(User $user, InputfieldWrapper $fieldset, array $settings)
(nothing)Get fields needed for a user to configure and confirm TFA from their user profile
Tfa::hookAfterInputfieldFormProcess(HookEvent $event)
(nothing)Hook after InputfieldForm::processInput() 
Tfa::hookBeforeInputfieldFormProcess(HookEvent $event)
(nothing)Hook before InputfieldForm::processInput() 
Tfa::hookInputfieldFormRender(HookEvent $event)
(nothing)Hook before InputfieldForm::render() 
Tfa::init()
(nothing)Module init 
Tfa::inputAttrs array Code <input> element attributes 
Tfa::inputLabel string Label for code <input> element 
Tfa::install()
(nothing)Module module and other assets required to execute it
Tfa::invalidCodeLabel string Invalid code error 
Tfa::isValidUserCode(User $user, $code, array $settings)
bool intReturn true if code is valid or false if not 
Tfa::maxAttemptsLabel string Max attempts error  
Tfa::process()
User boolProcess two-factor authentication code input
Tfa::processUserEnabledInputfields(User $user, InputfieldWrapper $fieldset, array $settings, array $settingsPrev)
arrayCalled when the user config fieldset has been processed (for enabled user) but before $settings have been saved
Tfa::processUserSettingsInputfields(User $user, InputfieldWrapper $fieldset, array $settings, array $settingsPrev)
arrayCalled when the user config fieldset has been processed but before $settings have been saved
Tfa::rememberClearLabel string Clear remembered browsers 
Tfa::rememberClearedLabel string Message after remembered browsers cleared 
Tfa::rememberDays int Number of days to "remember this browser", 0 to disable option, or -1 for no limit? (default=0) 
Tfa::rememberFingerprints array Fingerprints to remember: agent,agentVL,accept,scheme,host,ip,fwip (default=agentVL,accept,scheme,host) 
Tfa::rememberLabel string Label for "remember this browser" option  
Tfa::rememberSkipLabel string Indicates that code entry was skipped because browser is remembered 
Tfa::rememberSuccessLabel string Indicates that browser has been saved/remembered for n days. 
Tfa::render()
stringRender the code input form
Tfa::saveUserSettings(User $user, array $settings)
boolSave TFA data for given user to user_tfa field 
Tfa::sendCodeErrorLabel string Error creating or sending code 
Tfa::showCancel bool Show a cancel link under authentication code form? (default=true) 
Tfa::start(string $name, string $pass)
boolStart 2-factor authentication
Tfa::startUrl string URL we are operating from (default='./') 
Tfa::startUser(User $user, array $settings)
boolStart two-factor authentication for User 
Tfa::submitAttrs array Submit button attributes 
Tfa::submitLabel string Label for submit button 
Tfa::success()
boolReturns true when TFA has successfully completed and user is now logged in 
Tfa::timeLimitLabel string Time limit reached error 
Tfa::uninstall()
(nothing)Uninstall
Tfa::wired()
(nothing)Called when assigned to ProcessWire instance 

Additional methods and properties

In addition to the methods and properties above, Tfa also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.236

Latest news

  • ProcessWire Weekly #519
    In the 519th issue of ProcessWire Weekly we'll check out a new third party module called RockForms, introduce the latest ProcessWire core updates, and more. Read on!
    Weekly.pw / 20 April 2024
  • ProFields Table Field with Actions support
    This week we have some updates for the ProFields table field (FieldtypeTable). These updates are primarily focused on adding new tools for the editor to facilitate input and management of content in a table field.
    Blog / 12 April 2024
  • Subscribe to weekly ProcessWire news

“We were really happy to build our new portfolio website on ProcessWire! We wanted something that gave us plenty of control on the back-end, without any bloat on the front end - just a nice, easy to access API for all our content that left us free to design and build however we liked.” —Castus, web design agency in Sheffield, UK