diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php index 992c63cf893f541fef9b1458542cd922b5a7e433..59d183ee6510eeba9fc301aeaec0417c464920e1 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php @@ -53,17 +53,8 @@ class Password extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke ); } - if ($this->string->substr( - $password, - 0, - 1 - ) == ' ' || $this->string->substr( - $password, - $length - 1, - 1 - ) == ' ' - ) { - throw new LocalizedException(__('The password can\'t begin or end with a space.')); + if (trim($password) != $password) { + throw new LocalizedException(__('The password can not begin or end with a space.')); } $object->setPasswordHash($object->hashPassword($password));