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::buildAuthCodeForm()
InputfieldFormBuild the form used for two-factor authentication
Tfa::cancelLabel string Label to use for Cancel link (default='Cancel', translatable) 
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::enabledForUser(User $user, array $settings)
boolIs TFA enabled for given user? 
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::getUser()
UserGet current user for TFA 
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::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::isValidUserCode(User $user, $code, array $settings)
bool intReturn true if code is valid or false if not 
Tfa::process()
User boolProcess two-factor authentication
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::render()
stringRender the code input form
Tfa::saveUserSettings(User $user, array $settings)
boolSave TFA data for given user to user_tfa field 
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::uninstall()
(nothing)Uninstall

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.155

Twitter updates

  • This post covers a few of the bigger updates in ProcessWire 3.0.154+3.0.155. This includes new live replacement of text in core and modules, a new method for creating canonical URLs, and some major upgrades to our input->urlSegment() method! More
    24 April 2020
  • A brief look at what's new in ProcessWire 3.0.154 in this forum post: More
    17 April 2020
  • This week we’ve got a few new and interesting core updates in progress, though none quite ready to release just yet. So rather than releasing version 3.0.154 today, I thought we'd instead take a brief look at what’s coming over the next few weeks… More
    3 April 2020

Latest news

  • ProcessWire Weekly #311
    In the 311th issue of ProcessWire Weekly we're going to talk a bit about the latest dev versions of ProcessWire, introduce a couple of new third party modules, and more. Read on!
    Weekly.pw / 25 April 2020
  • ProcessWire 3.0.154 and 3.0.155 core updates
    This post covers a few of the bigger updates in ProcessWire 3.0.154 and 3.0.155 on the dev branch. This includes a new function for live replacement of text in core and modules, a new method for creating canonical URLs, and some major upgrades to our $input->urlSegment() method that I think you’ll like!
    Blog / 24 April 2020
  • Subscribe to weekly ProcessWire news

“To Drupal, or to ProcessWire? The million dollar choice. We decided to make an early switch to PW. And in retrospect, ProcessWire was probably the best decision we made. Thanks are due to ProcessWire and the amazing system and set of modules that are in place.” —Unni Krishnan, Founder of PigtailPundits