Sebastian
Sebastian

Reputation: 31

Password validation with vuetify

I need a password validation on my form. I use vuetify validation like this :

passwordRules: [
      v => (v && 0 !== v.length >= 10) || 'Min length should be 10',
      v => (v && v.length <= 35) || 'Max length should be 35',
      ],

I need a validation if password length is between 1 and 10 because I need to left a blank password. but the validation work however its 0 or 10.

Upvotes: 0

Views: 404

Answers (1)

Hans Felix Ramos
Hans Felix Ramos

Reputation: 4434

Write two rules and remove required prop from your input:

passwordRules: [
   v => (v && v.length >= 1) || 'Name must be more than 1 character',
   v => (v && v.length <= 10) || 'Name must be less than 10 characters',
],

Upvotes: 1

Related Questions