CredentialsValidator.php 773 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Customer\Model\Customer;
  8. use Magento\Framework\Exception\InputException;
  9. /**
  10. * Class to invalidate user credentials
  11. */
  12. class CredentialsValidator
  13. {
  14. /**
  15. * Check that password is different from email.
  16. *
  17. * @param string $email
  18. * @param string $password
  19. * @return void
  20. * @throws InputException
  21. */
  22. public function checkPasswordDifferentFromEmail($email, $password)
  23. {
  24. if (strcasecmp($password, $email) == 0) {
  25. throw new InputException(
  26. __("The password can't be the same as the email address. Create a new password and try again.")
  27. );
  28. }
  29. }
  30. }