Skip to content

Commit bc1b1e9

Browse files
committed
Replaced string check with simpler logic. Passes unit tests.
1 parent 142c88a commit bc1b1e9

File tree

1 file changed

+1
-10
lines changed
  • app/code/Magento/Customer/Model/Customer/Attribute/Backend

1 file changed

+1
-10
lines changed

app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,7 @@ public function beforeSave($object)
5353
);
5454
}
5555

56-
if ($this->string->substr(
57-
$password,
58-
0,
59-
1
60-
) == ' ' || $this->string->substr(
61-
$password,
62-
$length - 1,
63-
1
64-
) == ' '
65-
) {
56+
if (trim($password) != $password) {
6657
throw new LocalizedException(__('The password can not begin or end with a space.'));
6758
}
6859

0 commit comments

Comments
 (0)