2021年1月20日星期三

password validation is not working in vue.js

After checking user input for password if the requirement doesn't match i want to alert. but its not working Input form.

   <input type="password"  id="password" v-model="user.password" class="form-control" required></div>  

submit button

<button type="submit" class="btn"></button>  

data:

data: {              'user': {                  'name': '',                                     'password': '',              },          },  

methods:

 submit: function () {                    if (this.user.password != this.user.passwordConfirm) {                      Common.alert("Your password and confirmation password do not match.");                      return;                  }                  var has_minimum_lenth = (this.password.length > 8);                  var has_number    = /\d/.test(this.password);                  var has_lowercase = /[a-z]/.test(this.password);                  var has_uppercase = /[A-Z]/.test(this.password);                  var has_special   = /[!@#\$%\^\&*\)\(+=._-]/.test(this.password);                  if( !has_minimum_length ....................){                      Common.alert("bla bla bla bla");                      return;                   }              },  
https://stackoverflow.com/questions/65820569/password-validation-is-not-working-in-vue-js January 21, 2021 at 10:59AM

没有评论:

发表评论