From bc1b1e97c6176e2a5228738c137a6b2de16239f4 Mon Sep 17 00:00:00 2001
From: Kevin Schroeder <kschroeder@mirageworks.com>
Date: Thu, 18 Jun 2015 15:42:00 -0500
Subject: [PATCH] Replaced string check with simpler logic.  Passes unit tests.

---
 .../Model/Customer/Attribute/Backend/Password.php     | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

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 23ebcb64d01..b0d2b5fe533 100644
--- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php
+++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php
@@ -53,16 +53,7 @@ class Password extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke
                 );
             }
 
-            if ($this->string->substr(
-                $password,
-                0,
-                1
-            ) == ' ' || $this->string->substr(
-                $password,
-                $length - 1,
-                1
-            ) == ' '
-            ) {
+            if (trim($password) != $password) {
                 throw new LocalizedException(__('The password can not begin or end with a space.'));
             }
 
-- 
GitLab