public function BasicOverview::resetSkipValidationAttempts in Two-factor Authentication (TFA) 8
Resets TFA attempts for the given user account.
Parameters
array $form: The form definition.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
File
- src/
Form/ BasicOverview.php, line 263
Class
- BasicOverview
- TFA Basic account setup overview page.
Namespace
Drupal\tfa\FormCode
public function resetSkipValidationAttempts(array $form, FormStateInterface $form_state) {
$account = $form_state
->getValue('account');
$tfa_data = $this
->tfaGetTfaData($account
->id(), $this->userData);
$tfa_data['validation_skipped'] = 0;
$this
->tfaSaveTfaData($account
->id(), $this->userData, $tfa_data);
$this
->messenger()
->addMessage($this
->t('Validation attempts have been reset for user @name.', [
'@name' => $account
->getDisplayName(),
]));
$this
->logger('tfa')
->notice('Validation attempts reset for @account by @current_user.', [
'@account' => $account
->getAccountName(),
'@current_user' => $this
->currentUser()
->getAccountName(),
]);
}