public function TfaRecoveryCode::generateCodes in Two-factor Authentication (TFA) 8
Generate an array of secure recovery codes.
Return value
array An array of randomly generated codes.
Throws
\Exception
1 call to TfaRecoveryCode::generateCodes()
- TfaRecoveryCodeSetup::getSetupForm in src/
Plugin/ TfaSetup/ TfaRecoveryCodeSetup.php - Get the setup form for the validation method.
File
- src/
Plugin/ TfaValidation/ TfaRecoveryCode.php, line 171
Class
- TfaRecoveryCode
- Recovery validation class for performing recovery codes validation.
Namespace
Drupal\tfa\Plugin\TfaValidationCode
public function generateCodes() {
$codes = [];
for ($i = 0; $i < $this->codeLimit; $i++) {
$codes[] = $this
->randomCharacters(9, '1234567890');
}
return $codes;
}