Commit 903c1ccb authored by git's avatar git Committed by aohrvetpv
Browse files

Issue #3042612 by kim.pepper, Sergiu Stici: Drupal 9 Deprecated Code Report

parent af2618cb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ class PasswordPolicyEventSubscriber implements EventSubscriberInterface {
        $url = new Url('entity.user.edit_form', ['user' => $user->id()]);
        $url = $url->setAbsolute(TRUE)->toString();
        $event->setResponse(new RedirectResponse($url));
        drupal_set_message(t('Your password has expired, please update it'), 'error');
        \Drupal::messenger()->addError('Your password has expired, please update it');
      }
    }
  }
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class PasswordPolicyDeleteForm extends EntityConfirmFormBase {
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->entity->delete();

    drupal_set_message(
    $this->messenger()->addMessage(
      $this->t('The @label password policy has been deleted.',
        [
          '@type' => $this->entity->bundle(),
+3 −3
Original line number Diff line number Diff line
@@ -24,9 +24,9 @@ class PasswordPolicyRolesForm extends FormBase {
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
    $entity_manager = $container->get('entity.manager');
    return new static($entity_manager->getStorage('user_role'));
    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $container->get('entity_type.manager');
    return new static($entity_type_manager->getStorage('user_role'));
  }

  /**
+5 −5
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@ class PasswordReset extends FormBase {
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
    $entity_manager = $container->get('entity.manager');
    return new static($entity_manager->getStorage('user_role'), $entity_manager->getStorage('user'));
    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $container->get('entity_type.manager');
    return new static($entity_type_manager->getStorage('user_role'), $entity_type_manager->getStorage('user'));
  }

  /**
@@ -116,7 +116,7 @@ class PasswordReset extends FormBase {
        $user->save();
      }

      drupal_set_message(
      $this->messenger()->addMessage(
        $this->formatPlural(
          count($roles),
          'Reset the %roles role.',
@@ -126,7 +126,7 @@ class PasswordReset extends FormBase {
      );
    }
    else {
      drupal_set_message($this->t('No roles selected.'), 'warning');
      $this->messenger()->addWarning($this->t('No roles selected.'));
    }

    $form_state->setRedirectUrl(new Url('entity.password_policy.collection'));
+2 −2
Original line number Diff line number Diff line
@@ -2,14 +2,14 @@

namespace Drupal\password_policy;

use Drupal\Component\Plugin\ConfigurablePluginInterface;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Plugin\PluginFormInterface;

/**
 * An interface to define the expected operations of a password constraint.
 */
interface PasswordConstraintInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface {
interface PasswordConstraintInterface extends PluginInspectionInterface, ConfigurableInterface, PluginFormInterface {

  /**
   * Returns a true/false status if the password meets the constraint.