diff --git a/src/Form/EntryForm.php b/src/Form/EntryForm.php index ac4d6be..283c15c 100644 --- a/src/Form/EntryForm.php +++ b/src/Form/EntryForm.php @@ -150,7 +150,7 @@ class EntryForm extends FormBase { // Instantiate the validation plugin. $this->tfaValidationPlugin = $this->tfaValidationManager->createInstance($validation_plugin, ['uid' => $user->id()]); if ($this->tfaValidationPlugin instanceof TfaValidationSendInterface) { - $this->tfaValidationManager->begin($validation_plugin); + $this->tfaValidationManager->begin($this->tfaValidationPlugin); } // Get current validation plugin form. $form = $this->tfaValidationPlugin->getForm($form, $form_state); diff --git a/src/Form/TfaLoginForm.php b/src/Form/TfaLoginForm.php index 1b126c9..fadf89f 100644 --- a/src/Form/TfaLoginForm.php +++ b/src/Form/TfaLoginForm.php @@ -178,8 +178,8 @@ class TfaLoginForm extends UserLoginForm { // Instantiate the validation plugins. $validation_plugin_definitions = $this->tfaValidationManager->getDefinitions(); - foreach ($validation_plugin_definitions as $plugin_id => $plugin_definition) { - $plugin_instance = $this->tfaValidationManager->createInstance($plugin_definition, ['uid' => $user->id()]); + foreach (array_keys($validation_plugin_definitions) as $plugin_id) { + $plugin_instance = $this->tfaValidationManager->createInstance($plugin_id, ['uid' => $user->id()]); if ($plugin_instance instanceof TfaValidationSendInterface) { $this->tfaValidationManager->reset($plugin_instance); } diff --git a/src/TfaValidationPluginManager.php b/src/TfaValidationPluginManager.php index 892ef80..1c41f4c 100644 --- a/src/TfaValidationPluginManager.php +++ b/src/TfaValidationPluginManager.php @@ -45,9 +45,9 @@ class TfaValidationPluginManager extends DefaultPluginManager { protected $encryptService; /** - * Private Temporary Storage service. + * The tempstore object. * - * @var \Drupal\Core\TempStore\PrivateTempStoreFactory + * @var \Drupal\Core\TempStore\SharedTempStore */ protected $tempStore; @@ -69,16 +69,16 @@ class TfaValidationPluginManager extends DefaultPluginManager { * Encryption profile manager. * @param \Drupal\encrypt\EncryptServiceInterface $encrypt_service * Encryption service. - * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store - * Private temporary storage service. + * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory + * The tempstore factory service. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory, UserDataInterface $user_data, EncryptionProfileManagerInterface $encryption_profile_manager, EncryptServiceInterface $encrypt_service, PrivateTempStoreFactory $temp_store) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory, UserDataInterface $user_data, EncryptionProfileManagerInterface $encryption_profile_manager, EncryptServiceInterface $encrypt_service, PrivateTempStoreFactory $temp_store_factory) { parent::__construct('Plugin/TfaValidation', $namespaces, $module_handler, 'Drupal\tfa\Plugin\TfaValidationInterface', 'Drupal\tfa\Annotation\TfaValidation'); $this->alterInfo('tfa_validation'); $this->setCacheBackend($cache_backend, 'tfa_validation'); $this->userData = $user_data; $this->encryptService = $encrypt_service; - $this->tempStore = $temp_store; + $this->tempStore = $temp_store_factory->get('tfa_validation_plugin_manager'); $this->encryptionProfileManager = $encryption_profile_manager; }