Login icon indicating copy to clipboard operation
Login copied to clipboard

Password confirmation

Open dubrod opened this issue 9 years ago • 0 comments

core/components/login/model/login/loginvalidator.class.php

Password Confirmation was not getting the password field value through the "params". When i did it manually, it worked.

public function password_confirm($key,$value,$param = 'password_confirm') {
        if (empty($value)) return $this->modx->lexicon('register.password_not_confirmed');
        //$confirm = !empty($this->fields[$param]) ? $this->fields[$param] : '';
        $confirm = !empty($this->fields["password"]) ? $this->fields["password"] : '';
        if ($confirm != $value) {
            return $this->_getErrorMessage($key,'vTextPasswordConfirm','register.password_dont_match',array(
                'field' => $key,
                'password' => $value,
                'password_confirm' => $confirm,
            ));
        }
        return true;
    }

the validate code is:

password:required:minLength=^6^,
passwordagain:password_confirm=^password^

HTML:

<label for="password">[[%register.password]] [[!+error.password]]</label>
    <input type="password" name="password" id="password" value="[[+password]]" />

    <label for="passwordagain">Confirm Password [[!+error.passwordagain]]</label>
    <input type="password" name="passwordagain" id="passwordagain" value="[[+passwordagain]]" />

dubrod avatar May 30 '16 15:05 dubrod