1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-18 04:22:10 +02:00
This commit is contained in:
Ryan Cramer
2019-03-01 09:39:00 -05:00
parent be84331dbd
commit 731cc3e92e

View File

@@ -3,7 +3,7 @@
/** /**
* An Inputfield for handling a password * 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 * https://processwire.com
* *
* @property array $requirements Array of requirements (See require* constants) * @property array $requirements Array of requirements (See require* constants)
@@ -301,14 +301,16 @@ class InputfieldPassword extends InputfieldText {
$key = $this->attr('name'); $key = $this->attr('name');
$value = $this->attr('value'); $value = $this->attr('value');
if($value) {} if($value) {}
$confirmKey = "_" . $key;
if(!isset($input->$key)) return $this; if(!isset($input->$key)) return $this;
// form was submitted // form was submitted
$pass = $input->$key; $pass = $input->$key;
$confirmPass = $input->$confirmKey;
if(strlen($pass)) { if(strlen($pass) && strlen($confirmPass)) {
// password was submitted // password was submitted (with confirmation)
$allowInput = true; $allowInput = true;
if($this->requireOld > 0 && $user->isLoggedin()) { if($this->requireOld > 0 && $user->isLoggedin()) {
@@ -325,8 +327,7 @@ class InputfieldPassword extends InputfieldText {
} }
if($allowInput) { if($allowInput) {
$confirmKey = "_" . $key; if($confirmPass !== $pass) {
if($input->$confirmKey != $pass) {
$this->error($this->_("Passwords do not match")); $this->error($this->_("Passwords do not match"));
} }
$this->isValidPassword($pass); $this->isValidPassword($pass);