You are here

public function TfaRecoveryCodeSetup::getOverview in Two-factor Authentication (TFA) 8

Plugin overview page.

Parameters

array $params: Parameters to setup the overview information.

Return value

array The overview form.

Overrides TfaSetupInterface::getOverview

File

src/Plugin/TfaSetup/TfaRecoveryCodeSetup.php, line 37

Class

TfaRecoveryCodeSetup
TFA Recovery Code Setup Plugin.

Namespace

Drupal\tfa\Plugin\TfaSetup

Code

public function getOverview(array $params) {
  return [
    'heading' => [
      '#type' => 'html_tag',
      '#tag' => 'h2',
      '#value' => $this
        ->t('Recovery Codes'),
    ],
    'description' => [
      '#type' => 'html_tag',
      '#tag' => 'p',
      '#value' => $this
        ->t('Generate one-time use codes for two-factor login. These are generally used to recover your account in case you lose access to another 2nd-factor device.'),
    ],
    'setup' => [
      '#theme' => 'links',
      '#links' => [
        'reset' => [
          'title' => !$params['enabled'] ? $this
            ->t('Generate codes') : $this
            ->t('Reset codes'),
          'url' => Url::fromRoute('tfa.plugin.reset', [
            'user' => $params['account']
              ->id(),
            'method' => $params['plugin_id'],
            'reset' => 1,
          ]),
        ],
      ],
    ],
    'show_codes' => [
      '#theme' => 'links',
      '#access' => $params['enabled'],
      '#links' => [
        'show' => [
          'title' => $this
            ->t('Show codes'),
          'url' => Url::fromRoute('tfa.validation.setup', [
            'user' => $params['account']
              ->id(),
            'method' => $params['plugin_id'],
          ]),
        ],
      ],
    ],
  ];
}