public function TfaRecoveryCode::getCodes in Two-factor Authentication (TFA) 8
Get unused recovery codes.
@todo consider returning used codes so validate() can error with appropriate message
Return value
array Array of codes indexed by ID.
Throws
\Drupal\encrypt\Exception\EncryptionMethodCanNotDecryptException
\Drupal\encrypt\Exception\EncryptException
3 calls to TfaRecoveryCode::getCodes()
- TfaRecoveryCode::ready in src/
Plugin/ TfaValidation/ TfaRecoveryCode.php - Determine if the plugin can run for the current TFA context.
- TfaRecoveryCode::validate in src/
Plugin/ TfaValidation/ TfaRecoveryCode.php - Validate code.
- TfaRecoveryCodeSetup::getSetupForm in src/
Plugin/ TfaSetup/ TfaRecoveryCodeSetup.php - Get the setup form for the validation method.
File
- src/
Plugin/ TfaValidation/ TfaRecoveryCode.php, line 193
Class
- TfaRecoveryCode
- Recovery validation class for performing recovery codes validation.
Namespace
Drupal\tfa\Plugin\TfaValidationCode
public function getCodes() {
$codes = $this
->getUserData('tfa', 'tfa_recovery_code', $this->uid, $this->userData) ?: [];
array_walk($codes, function (&$v, $k) {
$v = $this
->decrypt($v);
});
return $codes;
}