class TfaTestSendSetup in Two-factor Authentication (TFA) 7.2
Class TfaTestSendSetup.
Hierarchy
- class \TfaBasePlugin
- class \TfaTestSend implements TfaSendPluginInterface, TfaValidationPluginInterface
- class \TfaTestSendSetup implements TfaSetupPluginInterface
- class \TfaTestSend implements TfaSendPluginInterface, TfaValidationPluginInterface
Expanded class hierarchy of TfaTestSendSetup
1 string reference to 'TfaTestSendSetup'
- TfaTestCase::testSetup in tests/
tfa.test - Test the TfaSetup forms and process in tfa_test.module.
File
- tests/
includes/ tfa_test.send.inc, line 120 - Tests for the TfaSendPluginInterface.
View source
class TfaTestSendSetup extends TfaTestSend implements TfaSetupPluginInterface {
/**
* {@inheritdoc}
*/
public function getSetupForm(array $form, array &$form_state) {
if (empty($form_state['storage']['location'])) {
$form['location'] = array(
'#type' => 'textfield',
'#title' => t('Location to send code'),
'#required' => TRUE,
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
}
else {
// Include code entry form.
$form = $this
->getForm($form, $form_state);
}
return $form;
}
/**
* {@inheritdoc}
*/
public function validateSetupForm(array $form, array &$form_state) {
if (!empty($form_state['values']['code']) && !$this
->validate($form_state['values']['code'])) {
$this->errorMessages['code'] = t('Invalid code. Please try again.');
return FALSE;
}
else {
return TRUE;
}
}
/**
* {@inheritdoc}
*/
public function submitSetupForm(array $form, array &$form_state) {
if (!empty($form_state['values']['location'])) {
// Code would be sent to $form_state['values']['location'].
$form_state['storage']['location'] = $form_state['values']['location'];
return FALSE;
}
else {
// Replace test code.
variable_set('tfa_test_code', $form_state['storage']['location']);
// Location would be saved.
return TRUE;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TfaBasePlugin:: |
protected | property | TFA code. | |
TfaBasePlugin:: |
protected | property | Code Length. | |
TfaBasePlugin:: |
protected | property | Context of current TFA process. | |
TfaBasePlugin:: |
protected | property | Encryption key. | |
TfaBasePlugin:: |
protected | property | Error messages. | |
TfaBasePlugin:: |
protected | property | Code is valid. | |
TfaBasePlugin:: |
constant | |||
TfaBasePlugin:: |
protected | function | Decrypt a encrypted string. | |
TfaBasePlugin:: |
protected | function | Decrypt using the deprecated Mcrypt extension. | |
TfaBasePlugin:: |
protected | function | Use OpenSSL to decrypt data that was originally encrypted with Mcrypt. | |
TfaBasePlugin:: |
protected | function | Encrypt a plaintext string. | |
TfaBasePlugin:: |
protected | function | Encrypt using the deprecated Mcrypt extension. | |
TfaBasePlugin:: |
protected | function | Generate a random string of characters of length $this->codeLength. | |
TfaBasePlugin:: |
public | function | Get error messages suitable for form_set_error(). | |
TfaBasePlugin:: |
private | function | A timing safe equals comparison. | |
TfaBasePlugin:: |
protected | function | Validate code. | |
TfaTestSend:: |
public | function |
TFA process begin. Overrides TfaSendPluginInterface:: |
|
TfaTestSend:: |
public | function | Check resend flood. | |
TfaTestSend:: |
public | function |
Get TFA process form from plugin. Overrides TfaValidationPluginInterface:: |
|
TfaTestSend:: |
public | function |
Determine if the plugin can run for the current TFA context. Overrides TfaBasePlugin:: |
|
TfaTestSend:: |
public | function |
Submit form. Overrides TfaBasePlugin:: |
|
TfaTestSend:: |
public | function |
Validate form. Overrides TfaValidationPluginInterface:: |
|
TfaTestSend:: |
public | function |
Constructor. Overrides TfaBasePlugin:: |
|
TfaTestSendSetup:: |
public | function |
Get setup form. Overrides TfaSetupPluginInterface:: |
|
TfaTestSendSetup:: |
public | function |
Submit setup form. Overrides TfaSetupPluginInterface:: |
|
TfaTestSendSetup:: |
public | function |
Validate setup form. Overrides TfaSetupPluginInterface:: |