Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Password EAV Attribute Backend model #1455

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(\Magento\Framework\Stdlib\String $string)
*/
public function beforeSave($object)
{
$password = $object->getPassword();
$password = (string)$object->getPassword();

$length = $this->string->strlen($password);
if ($length > 0) {
Expand All @@ -53,7 +53,7 @@ public function beforeSave($object)
);
}

if (trim($password) != $password) {
if (trim($password) !== $password) {
throw new LocalizedException(__('The password can not begin or end with a space.'));
}

Expand All @@ -67,8 +67,8 @@ public function beforeSave($object)
*/
public function validate($object)
{
$password = $object->getPassword();
if ($password && $password == $object->getPasswordConfirm()) {
$password = (string)$object->getPassword();
if ($password && $password === (string)$object->getPasswordConfirm()) {
return true;
}

Expand Down