Skip to content

validation rule password never match #1728

Description

@keulu-ing

Describe the bug
The validation error is always triggered when use required_with[] check
The validation error is always triggered when use matches[] check

CodeIgniter 4 version
alpha-5

Affected module(s)
Form Validator

Reproduce the behavior
my rules :

protected $validationRules    = [
        'password'     => 'required|min_length[8]',
        // 'password_confirm' => 'required_with[password]|matches[password]'
        'password_confirm' => 'matches[password]'
    ];
curl -X POST \
  localhost/users \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'cache-control: no-cache' \
  -d 'password=toto&password_confirm=toto'

"password_confirm": "The password_confirm field is required when password is present."

remove the require_check[]

"password_confirm": "The password_confirm field does not match the password field."

my validations_rules are in my model. everything seems to work exept this one.

Context

  • OS: LMDE2
  • Web server Nginx
  • PHP version 7.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions