diff --git a/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.module b/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.module index 43011082..18b70969 100644 --- a/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.module +++ b/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.module @@ -3,7 +3,7 @@ /** * An Inputfield for handling a password * - * ProcessWire 3.x, Copyright 2016 by Ryan Cramer + * ProcessWire 3.x, Copyright 2019 by Ryan Cramer * https://processwire.com * * @property array $requirements Array of requirements (See require* constants) @@ -301,14 +301,16 @@ class InputfieldPassword extends InputfieldText { $key = $this->attr('name'); $value = $this->attr('value'); if($value) {} + $confirmKey = "_" . $key; if(!isset($input->$key)) return $this; // form was submitted $pass = $input->$key; + $confirmPass = $input->$confirmKey; - if(strlen($pass)) { - // password was submitted + if(strlen($pass) && strlen($confirmPass)) { + // password was submitted (with confirmation) $allowInput = true; if($this->requireOld > 0 && $user->isLoggedin()) { @@ -325,8 +327,7 @@ class InputfieldPassword extends InputfieldText { } if($allowInput) { - $confirmKey = "_" . $key; - if($input->$confirmKey != $pass) { + if($confirmPass !== $pass) { $this->error($this->_("Passwords do not match")); } $this->isValidPassword($pass);