验证密码强度

if (data.match(/^[0-9]{6,20}$|^[a-zA-Z]{6,20}$|[!@#$%^&*]{6,20}$/)) {
this.formGroup.get('newPassword').setErrors({ passwordSuggestRules: true });
this.passwordStrong = 1;
} else if (data.match(/^[0-9a-zA-Z]{6,20}$|^[a-zA-Z!@#$%^&*]{6,20}$|[0-9!@#$%^&*]{6,20}$/)) {
this.passwordStrong = 2;
} else {
this.passwordStrong = 3;
}

猜你喜欢

转载自www.cnblogs.com/lskzj/p/js.html