You are here

protected function TfaDataTrait::tfaGetTfaData in Two-factor Authentication (TFA) 8

Get TFA data for an account.

Parameters

int $uid: User account id.

\Drupal\user\UserDataInterface $user_data: User data object to store user specific information.

Return value

array TFA data.

7 calls to TfaDataTrait::tfaGetTfaData()
BasicOverview::buildForm in src/Form/BasicOverview.php
Form constructor.
BasicOverview::resetSkipValidationAttempts in src/Form/BasicOverview.php
Resets TFA attempts for the given user account.
BasicSetup::buildForm in src/Form/BasicSetup.php
Form constructor.
TfaContext::hasSkipped in src/TfaContext.php
Increment the count of $this->getUser() logins without setting up TFA.
TfaContext::isTfaRequired in src/TfaContext.php
Check whether $this->getUser() is required to use TFA.

... See full list

File

src/TfaDataTrait.php, line 137

Class

TfaDataTrait
Provides methods to save tfa user settings.

Namespace

Drupal\tfa

Code

protected function tfaGetTfaData($uid, UserDataInterface $user_data) {
  $result = $this
    ->getUserData('tfa', 'tfa_user_settings', $uid, $user_data);
  if (!empty($result)) {
    return [
      'status' => $result['status'] == '1',
      'saved' => $result['saved'],
      'data' => $result['data'],
      'validation_skipped' => $result['validation_skipped'],
    ];
  }
  return [];
}