public function TfaRecoveryCode::storeCodes in Two-factor Authentication (TFA) 8
Save recovery codes for current account.
Parameters
array $codes: Recovery codes for current account.
Throws
\Drupal\encrypt\Exception\EncryptException
2 calls to TfaRecoveryCode::storeCodes()
- TfaRecoveryCode::validate in src/
Plugin/ TfaValidation/ TfaRecoveryCode.php - Validate code.
- TfaRecoveryCodeSetup::submitSetupForm in src/
Plugin/ TfaSetup/ TfaRecoveryCodeSetup.php - Submit the setup form.
File
- src/
Plugin/ TfaValidation/ TfaRecoveryCode.php, line 209
Class
- TfaRecoveryCode
- Recovery validation class for performing recovery codes validation.
Namespace
Drupal\tfa\Plugin\TfaValidationCode
public function storeCodes(array $codes) {
$this
->deleteCodes();
// Encrypt code for storage.
array_walk($codes, function (&$v, $k) {
$v = $this
->encrypt($v);
});
$data = [
'tfa_recovery_code' => $codes,
];
$this
->setUserData('tfa', $data, $this->uid, $this->userData);
}