1function checkpassfunc() { 2 var a = $("#form-password"); 3 var usr = a.val(); 4 var b = $("#password__used"); 5 6 //validate password must have upper, lower chars and number 7 // var re = (/([a-z].*[A-Z])|([A-Z].*[a-z])/); 8 var re = (/(?=^.{6,12}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/); 9 10 if ((usr.length > 5) && (usr.length < 13)) { 11 if (re.test(usr)) { 12 //ok 13 a.removeClass("validate-form-red"); 14 a.addClass("validate-form-green"); 15 b.html(""); 16 b.hide(); 17 b.attr('aria-hidden', 'true'); 18 a.attr('data-invalid', 'false'); 19 20 } else { 21 //password not strong enough 22 b.attr('aria-hidden', 'false'); 23 a.attr('data-invalid', 'true'); 24 a.removeClass("validate-form-green"); 25 a.addClass("validate-form-red"); 26 b.show(); 27 b.html("Password must contain at least one upper, lowercase and a number"); 28 } 29 } else { 30 //password not long enough 31 b.attr('aria-hidden', 'false'); 32 a.attr('data-invalid', 'true'); 33 a.removeClass("validate-form-green"); 34 a.addClass("validate-form-red"); 35 b.show(); 36 b.html("Password must be between 6 and 12 characters"); 37 } 38} 39 40function checkrepeatedpassfunc() { 41 var a = $("#form-password"); 42 var passOne = a.val(); 43 var b = $("#password__used"); 44 var c = $("#form-confirm-password"); 45 var e = $("#password__confirm");
46 var passTwo = c.val(); 47 48 if ((passOne.length > 5) && (passOne.length < 13) && (passOne.length === passTwo.length) && (passOne === passTwo)) { 49 //matches 50 c.removeClass("validate-form-red"); 51 c.addClass("validate-form-green"); 52 b.attr('aria-hidden', 'true'); 53 e.html(""); 54 e.hide(); 55 e.attr('aria-hidden', 'true'); 56 c.attr('data-invalid', 'false'); 57 58 } else { 59 //no match 60 b.attr('aria-hidden', 'false'); 61 c.removeClass("validate-form-green"); 62 c.addClass("validate-form-red"); 63 c.attr('data-invalid', 'true'); 64 e.show(); 65 e.html("Password incomplete or does not match"); 66 } 67}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.