Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CredentialsValidator.php
Go to the documentation of this file.
1 <?php
8 
10 
15 {
24  public function validate($username, $password)
25  {
26  $exception = new InputException();
27  if (!is_string($username) || strlen($username) == 0) {
28  $exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'username']));
29  }
30  if (!is_string($password) || strlen($password) == 0) {
31  $exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'password']));
32  }
33  if ($exception->wasErrorAdded()) {
34  throw $exception;
35  }
36  }
37 }
__()
Definition: __.php:13