From 731cc3e92e73d40ffe2816825cea91618697284e Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 1 Mar 2019 09:39:00 -0500 Subject: [PATCH] Fix issue processwire/processwire-issues#432 --- .../InputfieldPassword/InputfieldPassword.module | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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);