1(function (window, $) { 2 "use strict"; 3 window.AUTH_SERVER = { 4 common: { 5 init: function () {}, 6 }, 7 logout: { 8 init: function () { 9 if ( 10 $("#redirect-uri").length && 11 $("#redirect-uri").data("redirect-uri") != null 12 ) { 13 setTimeout(function () { 14 window.location.href = $("#redirect-uri").data("redirect-uri"); 15 }, 2000); 16 } 17 }, 18 }, 19 login: { 20 init: function () {}, 21 }, 22 qualcommPasswordConfirmation: { 23 passwordField: null, 24 pwStrengthContainer: null, 25 pwStrengthLabel: null, 26 pwStrengthLabelOptions: { 27 none: "", 28 weak: "", 29 sufficient: "", 30 strong: "", 31 tooLong: "", 32 }, 33 init: function () { 34 var controller = this; 35 var h = { 36 none: "None", 37 weak: "Weak", 38 sufficient: "Sufficient", 39 strong: "Strong", 40 tooLong: "Too Long", 41 }; 42 controller.initPasswordStrength("#password", h); 43 }, 44 initPasswordStrength: function (passwordFieldSelector, options) { 45 this.passwordField = $(passwordFieldSelector); 46 this.pwStrengthContainer = $(".progress-container"); 47 this.pwStrengthIndicator = $("progress"); 48 this.pwStrengthLabel = $(".pw-strength-label"); 49 $.extend(this.pwStrengthLabelOptions, options); 50 51 this.calculatePasswordStrength(this.passwordField.val()); 52 var that = this; 53 this.passwordField.on("keyup input change", function () { 54 that.calculatePasswordStrength($(this).val()); 55 }); 56 }, 57 calculatePasswordStrength: function (password) { 58 var strength = this.getPasswordStrength(password); 59 if (strength == "None") { 60 this.changeStrengthMeter("0", this.pwStrengthLabelOptions.none); 61 return; 62 } 63 if (strength == "Weak") { 64 this.changeStrengthMeter( 65 "33", 66 this.pwStrengthLabelOptions.weak, 67 "pw-strength-color-weak" 68 ); 69 return; 70 } 71 if (strength == "Sufficient") { 72 this.changeStrengthMeter( 73 "66", 74 this.pwStrengthLabelOptions.sufficient, 75 "pw-strength-color-sufficient" 76 ); 77 return; 78 } 79 if (strength == "Strong") { 80 this.changeStrengthMeter( 81 "100", 82 this.pwStrengthLabelOptions.strong, 83 "pw-strength-color-strong" 84 ); 85 return; 86 } 87 if (strength == "TooLong") { 88 this.changeStrengthMeter( 89 "100", 90 this.pwStrengthLabelOptions.tooLong, 91 "pw-strength-color-weak" 92 ); 93 return; 94 } 95 }, 96 getPasswordStrength: function (password) { 97 let regex = 98 /^(?!.*\s)(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~`!@#$%^&*()--+={}\[\]|\\:;"'<>,.?/_â¹]).{10,12}$/; 99 if (password.match(regex)) { 100 return "Strong"; 101 } 102 let regexSufficient = 103 /^(?!.*\s)(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~`!@#$%^&*()--+={}\[\]|\\:;"'<>,.?/_â¹]).{8,12}$/; 104 if (password.match(regexSufficient)) { 105 return "Sufficient"; 106 } 107 let regexTooLong = /^.{12,}$/; 108 if (password.match(regexTooLong)) { 109 return "TooLong"; 110 } 111 if (password.length >= 1) { 112 return "Weak"; 113 } 114 return "None"; 115 }, 116 changeStrengthMeter: function (percentage, message, colorClass) { 117 this.pwStrengthIndicator.prop("value", percentage); 118 this.pwStrengthContainer 119 .removeClass("pw-strength-color-weak") 120 .removeClass("pw-strength-color-sufficient") 121 .removeClass("pw-strength-color-strong"); 122 this.pwStrengthLabel 123 .removeClass("pw-strength-color-weak") 124 .removeClass("pw-strength-color-sufficient") 125 .removeClass("pw-strength-color-strong"); 126 if (colorClass != null && typeof colorClass !== "undefined") { 127 this.pwStrengthContainer.addClass(colorClass); 128 this.pwStrengthLabel.addClass(colorClass); 129 } 130 this.pwStrengthLabel.empty(); 131 this.pwStrengthLabel.text(message); 132 }, 133 }, 134 qualcommVerifyCode: { 135 initResendCode: function () { 136 $("#resendCode").click(function (e) { 137 e.preventDefault(); 138 if (
139 $("#resend-code-min").html() === "0" && 140 $("#resend-code-sec").html() === "0" 141 ) { 142 $("#password").remove(); 143 $("#verifyCodeForm").submit(); 144 } 145 }); 146 }, 147 initSubmit: function () { 148 $("#submitButton").click(function () { 149 var concatValue = 150 $("#verify-code-0").val() + 151 $("#verify-code-1").val() + 152 $("#verify-code-2").val() + 153 $("#verify-code-3").val(); 154 $("#password").val(concatValue); 155 }); 156 }, 157 initVerifyCode: function () { 158 $(".verify-code") 159 .keyup(function (event) { 160 var index = parseInt($(this).data("index")), 161 $prev = $(".verify-code[data-index=" + (index - 1) + "]"), 162 $next = $(".verify-code[data-index=" + (index + 1) + "]"), 163 anyBlank = false; 164 165 console.log("event: " + event.which); 166 console.log("index: " + index); 167 168 console.log("length: " + $(this).val().length); 169 170 $(this).val($.trim($(this).val())); 171 172 if (index > 0) { 173 if ( 174 $(this).val().length === 0 && 175 $(this).hasClass("empty-field") && 176 (event.which === 8 || event.which === 46) 177 ) { 178 $prev.val("").focus(); 179 } 180 } 181 182 if (event.which == 37) { 183 if (index > 0) { 184 $prev.focus(); 185 } else { 186 $(this).focus(); 187 } 188 } else if (event.which == 39) { 189 $next.focus(); 190 } else if ($(this).val().length == $(this).attr("maxlength")) { 191 $next.focus(); 192 } else if ($(this).val().length > $(this).attr("maxlength")) { 193 $(this).val($(this).val().substring(0, 1)); 194 } 195 196 $(".verify-code").each(function () { 197 if ($(this).val().length == 0) { 198 anyBlank = true; 199 $(this).addClass("empty-field"); 200 } else { 201 $(this).removeClass("empty-field"); 202 } 203 }); 204 205 if ( 206 event.which !== 8 && // 207 event.which !== 37 && // 208 event.which !== 39 && // 209 event.which !== 46 && // 210 !anyBlank 211 ) { 212 $("#submitButton").removeClass("btn-disabled"); 213 $("#submitButton").removeAttr("disabled"); 214 } else { 215 $("#submitButton").addClass("btn-disabled"); 216 $("#submitButton").attr("disabled", "disabled"); 217 } 218 }) 219 .focus(function () { 220 var length = $(this).val().length; 221 222 console.log("focus!!: " + length); 223 224 $(this)[0].setSelectionRange(length, length); 225 }); 226 }, 227 init: function () { 228 var controller = this; 229 230 controller.initResendCode(); 231 controller.initVerifyCode(); 232 controller.initSubmit(); 233 234 COMPAX_UTIL.initCountdown( 235 $("#resend-code-min"), 236 15, 237 $("#resend-code-sec"), 238 0 239 ); 240 }, 241 }, 242 }; 243})(window, jQuery); 244 245$(document).ready(function () { 246 COMPAX_UTIL.init(AUTH_SERVER, true); 247});
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.