Skip to content
This repository was archived by the owner on May 4, 2020. It is now read-only.
This repository was archived by the owner on May 4, 2020. It is now read-only.

Password confirmation validation #18

Description

@skiwi2

Currently I'm using the following schema:

validatorTypes: function() {
    return {
        username: Joi.string().min(4).max(20).required().label(this.refs.username.props.label),
        email: Joi.string().email().required().label(this.refs.email.props.label),
        password: Joi.string().min(6).max(20).required().label(this.refs.password.props.label),
        confirmPassword: Joi.any().valid(Joi.ref('password')).required().label(this.refs.confirmPassword.props.label)
    };
},

However this is leading to situations which might be incorrect, but are definitely unwanted:

  1. When both password and confirmPassword are empty, then this.getValidationMessages('confirmPassword')[0] is empty.
  2. When both password and confirmPassword are matching but have an incorrect length, then this.getValidationMessages('confirmPassword')[0] is also empty.

How can I prevent these situations from occuring?

I have also opened an issue over at hapijs/joi#652, but it seems to be that the issue is directly related to this library.

Activity

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions