reverted: --- b/src/Form/BasicDisable.php +++ a/src/Form/BasicDisable.php @@ -134,7 +134,6 @@ public function validateForm(array &$form, FormStateInterface $form_state) { $user = User::load($this->currentUser()->id()); $storage = $form_state->getStorage(); - /** @var \Drupal\user\UserInterface $account */ $account = $storage['account']; // Allow administrators to disable TFA for another account. if ($account->id() != $user->id() && $user->hasPermission('administer users')) { @@ -154,16 +153,15 @@ $storage = $form_state->getStorage(); $values = $form_state->getValues(); - /** @var \Drupal\user\UserInterface $account */ $account = $storage['account']; if ($values['op'] === $values['cancel']) { $this->messenger()->addMessage($this->t('TFA disable canceled.')); $form_state->setRedirect('tfa.overview', ['user' => $account->id()]); return; } // Delete all user data. + $this->deleteUserData('tfa', null, $account->id(), $this->userData); - $this->deleteUserData('tfa', NULL, $account->id(), $this->userData); \Drupal::logger('tfa')->notice('TFA disabled for user @name UID @uid', [ '@name' => $account->getAccountName(), only in patch2: diff -u b/src/Form/TfaLoginForm.php b/src/Form/TfaLoginForm.php --- b/src/Form/TfaLoginForm.php +++ b/src/Form/TfaLoginForm.php @@ -115,7 +115,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('flood'), - $container->get('entity.manager')->getStorage('user'), + $container->get('entity_type.manager')->getStorage('user'), $container->get('user.auth'), $container->get('renderer'), $container->get('plugin.manager.tfa.validation'), --- a/src/Plugin/TfaLogin/TfaTrustedBrowser.php +++ b/src/Plugin/TfaLogin/TfaTrustedBrowser.php @@ -2,7 +2,6 @@ namespace Drupal\tfa\Plugin\TfaLogin; -use Drupal\Component\Utility\Crypt; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\encrypt\EncryptionProfileManagerInterface; @@ -116,7 +115,7 @@ class TfaTrustedBrowser extends TfaBasePlugin implements TfaLoginInterface, TfaV * Base64 encoded browser id. */ protected function generateBrowserId() { - $id = base64_encode(Crypt::randomBytes(32)); + $id = base64_encode(random_bytes(32)); return strtr($id, ['+' => '-', '/' => '_', '=' => '']); } only in patch2: unchanged: --- a/src/TfaRandomTrait.php +++ b/src/TfaRandomTrait.php @@ -2,8 +2,6 @@ namespace Drupal\tfa; -use Drupal\Component\Utility\Crypt; - /** * Trait TfaRandomTrait for generating cryptographically secure random data. * @@ -79,7 +77,7 @@ trait TfaRandomTrait { for ($i = 0; $i < $length; $i++) { do { // Find a secure random number within the range needed. - $index = ord(Crypt::randomBytes(1)); + $index = ord(random_bytes(1)); } while ($index > $len); // Each iteration, pick a random character from the