1var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opener = _____WB$wombat$assign$function_____("opener"); 10function persianToEnglish(value) { 11 var newValue=""; 12 for (var i=0;i<value.length;i++) 13 { 14 var ch=value.charCodeAt(i); 15 if (ch>=1776 && ch<=1785) // For Persian digits. 16 { 17 var newChar=ch-1728; 18 newValue=newValue+String.fromCharCode(newChar); 19 } 20 else if(ch>=1632 && ch<=1641) // For Arabic & Unix digits. 21 { 22 var newChar=ch-1584; 23 newValue=newValue+String.fromCharCode(newChar); 24 } 25 else 26 newValue=newValue+String.fromCharCode(ch); 27 } 28 return newValue; 29} 30//custom mersa 31 function custom_mersa_phone_prefix(countrycode, phone){ 32 var phone_prefix = dig_mdet.digits_mersa_billing_phone_prefix; 33 switch(phone_prefix){ 34 case 'cc': 35 phone = countrycode+phone; 36 break; 37 case 'ziro' : 38 phone = '0'+parseInt(phone); 39 break; 40 case 'none' : 41 phone = parseInt(phone); 42 break; 43 } 44 return phone; 45 } 46jQuery(function () { 47 48 var precode; 49 var secure_wrap = '<div class="digits-form_tab_wrapper"><div class="digits-form_tab_container"></div></div>'; 50 51 var forgotPassChange = 0; 52 var dig_reg_wp_elem = jQuery("#dig_reg_wp_elem"); 53 if (dig_reg_wp_elem.length) { 54 dig_reg_wp_elem = dig_reg_wp_elem.closest('form'); 55 if (!dig_reg_wp_elem.hasClass("dokan-vendor-register")) { 56 57 if (dig_reg_wp_elem.find(".dig_wc_reg_form_end").length === 0) { 58 dig_reg_wp_elem.addClass('wp_reg'); 59 dig_reg_wp_elem.find("#user_login").attr('id', 'user_uname'); 60 jQuery(".digits_register").removeClass('wp_reg'); 61 } else { 62 dig_reg_wp_elem.find(".dig_wp_bp_fields").remove(); 63 } 64 } 65 } 66 67 var dig_login_wp_elem = jQuery("#dig_login_wp_elem"); 68 if (dig_login_wp_elem.length) { 69 if (dig_mdet.login_mobile_accept > 0) { 70 dig_login_wp_elem = dig_login_wp_elem.closest('form'); 71 72 if (dig_login_wp_elem.find(".loginuname").length === 0) { 73 dig_login_wp_elem.addClass('wp_login'); 74 dig_login_wp_elem.find("input[type='text']").first().attr({'id': 'username', 'nan': 1}); 75 } else { 76 dig_login_wp_elem.find(".dig_bb_wp_otp_field").remove(); 77 } 78 } 79 } 80 81 var akCallback = -1; 82 var useWhatsApp = 0; 83 84 jQuery("#digit_emailaddress").closest("form").addClass("register"); 85 jQuery("#wc_code_dig").closest("form").addClass("login"); 86 jQuery("#digits_wc_code").closest("form").addClass("woocommerce-ResetPassword"); 87 88 if (dig_log_obj.dig_dsb == 1) return; 89 90 var loader = jQuery(".dig_load_overlay"); 91 var tokenCon; 92 93 function checkoutwc_comp() { 94 var cfw_login_modal = jQuery('#cfw_login_modal_form'); 95 if (cfw_login_modal.length > 0) { 96 var cfw_username = cfw_login_modal.find('#cfw_login_username_field'); 97 cfw_username.find('#cfw_login_username').attr({ 98 'placeholder': dig_mdet.emailormobile, 99 }).addClass('digits_mobile_field'); 100 cfw_username.find('label').text(dig_mdet.emailormobile); 101 102 cfw_login_modal.find('.loginViaContainer button,.digits-form_submit-btn').addClass('cfw-primary-btn'); 103 104 var otp_container = cfw_login_modal.find('#dig_wc_log_otp_container'); 105 if (otp_container.length > 0) { 106 otp_container.addClass('col-lg-12 cfw-text-input cfw-input-wrap cfw-label-is-floated'); 107 otp_container.insertAfter(cfw_username); 108 } 109 110 if (dig_mdet.secure_forms) { 111 cfw_login_modal.find('#cfw_login_password_field').remove(); 112 cfw_login_modal.find('#cfw-login-btn').remove(); 113 cfw_login_modal.find('.cfw-login-modal-navigation').insertAfter(jQuery(cfw_login_modal.find('.digits-form_submit-btn'))); 114 115 var last_cfw_submit_index = cfw_username.index() + 1 116 cfw_login_modal.children().slice(3, last_cfw_submit_index).wrapAll(secure_wrap); 117 118 cfw_username.find('#cfw_login_username').attr({ 119 'id': 'username', 120 }); 121 } 122 123 } 124 } 125 126 function merge_billing_field() { 127 function dig_wc_merge_field(field_name) {
128 var bp_wc = jQuery("#" + field_name); 129 if (bp_wc.length > 0) { 130 131 var bp_wc_val = bp_wc.val(); 132 var countrycode = dig_mdet.uccode.replace('+', ''); 133 /* 134 // ب٠خاطر تکرار شد٠کد Ú©Ø´ÙØ± در Ø´Ù Ø§Ø±Ù ØµÙØ±ØªØØ³Ø§Ø¨ ÙÙکا٠رس کد Ú©Ø´ÙØ± را از Ø´Ù Ø§Ø±Ù Ù Ø´ØªØ±Û ØØ°Ù Ù Û Ú©ÙÙ 135 //var phone_no = bp_wc_val.replace(dig_mdet.uccode+"0",'').replace(dig_mdet.uccode,''); 136 137 //TODO: Ø¨Ø±Ø§Û ØºÛØ±Ùغا٠کرد٠کتابخاÙ٠تÙÙ٠ک٠شرط Ø²ÛØ± را ØºÛØ±Ùعا٠ک٠138 if (bp_wc.data('countryCode')) { 139 countrycode = bp_wc.data('countryCode'); 140 } else { 141 var phone_obj = libphonenumber.parsePhoneNumberFromString('+'+bp_wc_val.replace('+','')); 142*/ 143 var phone_no = bp_wc_val; 144 if (bp_wc.attr('countryCode')) { 145 countrycode = bp_wc.attr('countryCode'); 146 countrycode = countrycode.replace('+', ''); 147 if(bp_wc.attr('user_phone')) { 148 phone_no = bp_wc.attr('user_phone'); 149 } 150 } else { 151 var bp_wc_phone = bp_wc_val.replace('+', ''); 152 var phone_obj; 153 if(!bp_wc_val.includes('+')) { 154 if (bp_wc.attr('billing_country_code')) { 155 var billingCountryCode = bp_wc.attr('billing_country_code'); 156 phone_obj = libphonenumber.parsePhoneNumberFromString('+' + billingCountryCode + bp_wc_phone); 157 } 158 } 159 if (typeof phone_obj == "undefined") { 160 phone_obj = libphonenumber.parsePhoneNumberFromString('+' + bp_wc_phone); 161 } 162 163 if (typeof phone_obj != "undefined") { 164 countrycode = phone_obj.countryCallingCode; 165 phone_no = phone_obj.nationalNumber; 166 } 167 } 168 169 bp_wc.attr({ 170 'only-mob': 1, 171 'f-mob': 1, 172 'countryCode': countrycode, 173 'value': phone_no, 174 'mob': 1, 175 "id": 'username', 176 'data-dig-main': field_name, 177 }).parent().append('<input type="hidden" name="' + field_name + '" id="' + field_name + '" value="' + bp_wc_val + '" />'); 178 179 return true; 180 } 181 return false; 182 } 183 184 var wc_phone_billing_merge = dig_wc_merge_field('billing_phone'); 185 var wc_phone_shipping_merge = dig_wc_merge_field('shipping_phone'); 186 if (wc_phone_billing_merge) { 187 checkoutwc_comp(); 188 } 189 } 190 191 merge_billing_field(); 192 193 function loginuser(response) { 194 if (precode == response.code) { 195 return false; 196 } 197 198 var rememberMe = 0; 199 if (jQuery("#rememberme").length) { 200 rememberMe = jQuery("#rememberme:checked").length > 0; 201 } 202 precode = response.code; 203 jQuery.ajax({ 204 type: 'post', 205 url: dig_mdet.ajax_url, 206 data: { 207 action: 'digits_login_user', 208 code: response.code, 209 csrf: response.state, 210 rememberMe: rememberMe, 211 }, 212 success: function (res) { 213 if (isJSON(res)) { 214 215 if (!res.data.code) { 216 res = res; 217 } else { 218 if (res.data.error_msg) { 219 loader.hide(); 220 if (res.data.error_type) { 221 showDigMessage(res.data.error_msg, res.data.error_type); 222 } else { 223 showDigErrorMessage(res.data.error_msg); 224 } 225 return; 226 } 227 228 if (res.redirect) { 229 showDigLoginSuccessMessage(); 230 digits_redirect(res.redirect); 231 return; 232 } 233 res = res.code; 234 } 235 } else { 236 res = res.trim(); 237 } 238 239 loader.hide(); 240 if (res == "1") { 241 242 if (ihc_loginform == 10) 243 document.location.href = "/"; 244 else { 245 246 showDigLoginSuccessMessage(); 247 if (jQuery("#digits_redirect_page").length) { 248 digits_redirect(jQuery("#digits_redirect_page").val()); 249 } else digits_redirect(dig_mdet.uri); 250 } 251 252 } else if (res == -1) { 253 showDigNoticeMessage(dig_mdet.pleasesignupbeforelogginin); 254 } else if (res == -9) { 255 showDigErrorMessage(dig_mdet.invalidapicredentials); 256 } else { 257 showDigErrorMessage(dig_mdet.invalidlogindetails); 258 } 259 260 } 261 }); 262 263 return false; 264 } 265 266 function forgotihcCallback(response) { 267 showDigitsLoader(true); 268 if (response.status === "PARTIALLY_AUTHENTICATED") { 269 270 jQuery("#digits_impu_code").val(response.code); 271 jQuery("#digits_impu_csrf").val(response.csrf); 272 273 jQuery("#digits_password_ihc_cont").show().find("input").attr("required", "required"); 274 jQuery("#digits_cpassword_ihc_cont").show().find("input").attr("required", "required");
275 forgotpassihc = 2; 276 277 } 278 } 279 280// login callback 281 function loginCallback(response) { 282 if (response.status === "PARTIALLY_AUTHENTICATED") { 283 284 showDigitsLoader(false); 285 loginuser(response); 286 } else if (response.status === "NOT_AUTHENTICATED") { 287 showDigitsLoader(true); 288 } else if (response.status === "BAD_PARAMS") { 289 showDigitsLoader(true); 290 } 291 292 } 293 294// phone form submission handler 295 function smsLogin() { 296 297 } 298 299 function phonenumber(data) { 300 var phoneno = /^\+?([0-9]{2})\)?[-. ]?([0-9]{4})[-. ]?([0-9]{4})$/; 301 return !!(data.match(phoneno)); 302 } 303 304 var reg_email = jQuery("#reg_email"); 305 var mailsecond = jQuery(".dig_wc_mailsecond"); 306 var mailSecondLabel = jQuery("#dig_secHolder"); 307 var secondmailormobile = jQuery("#secondmailormobile"); 308 309 var user_login = jQuery("#user_login"); 310 311 var otp_field; 312 var show_message = true; 313 var is_checkout = false; 314 var ew = 30; 315 316 jQuery('input[id="account_email"]').each(function (index) { 317 jQuery(this).parent().find('label').find('span').remove(); 318 }); 319 320 var dig_sortorder = dig_mdet.dig_sortorder; 321 var register = jQuery(".dig_wc_reg_form").closest(".register"); 322 if (dig_sortorder.length) { 323 register.find("#reg_username").closest('.form-row').attr('id', 'dig_cs_username').addClass('dig-custom-field'); 324 register.find("#reg_password").closest('.form-row').attr('id', 'dig_cs_password').addClass('dig-custom-field'); 325 326 if (dig_mdet.mobile_accept > 0) { 327 register.find("#reg_email").parent().attr({ 328 'id': 'dig_cs_mobilenumber', 329 'class': 'dig-custom-field woocommerce-FormRow--wide form-row form-row-wide' 330 }); 331 } else { 332 register.find("#reg_email").parent().attr({ 333 'id': 'dig_cs_email', 334 'class': 'dig-custom-field woocommerce-FormRow--wide form-row form-row-wide' 335 }); 336 } 337 338 var sortorder = dig_sortorder.split(','); 339 var digits_register_inputs = register; 340 341 digits_register_inputs.each(function () { 342 jQuery(this).find('.dig-custom-field').sort(function (a, b) { 343 var ap = jQuery.inArray(a.id, sortorder); 344 var bp = jQuery.inArray(b.id, sortorder); 345 return (ap < bp) ? -1 : (ap > bp) ? 1 : 0; 346 }).prependTo(jQuery(this)); 347 }); 348 349 } 350 351 var c = jQuery(".ihc-form-create-edit"); 352 353 if (c.length && dig_mdet.mobile_accept > 0) { 354 /*iump reg*/ 355 var f = jQuery(".iump-register-form").find("#createuser"); 356 var i_ccode = dig_mdet.uccode; 357 358 f.find("input[name='phone']").attr({ 359 "data-dig-main": 1, 360 "reg": 2, 361 "data-skip-label": 1, 362 "id": "username", 363 "mob": 1, 364 "countryCode": i_ccode, 365 "nan": 1, 366 "f-mob": 1, 367 }).data('type', 2); 368 369 jQuery('<input type="hidden" id="dig_ihc_ea_code" name="code"/><input type="hidden" id="dig_ihc_ea_csrf" name="csrf"/><div id="dig_ihc_mobotp" class="iump-form-line-register iump-form-text" style="display:none;">' + 370 '<input value="" id="digits_otp_ihc" name="digit_otp" placeholder="' + dig_mdet.OTP + '" type="tel" style="padding-left:10px !important;">') 371 .insertBefore(f.find("input[type='submit']").closest('.iump-submit-form'));
372 373 } 374 375 var wcform = jQuery("#wc_dig_reg_form").closest("form"); 376 var wc_checkout = jQuery(".woocommerce-form-login"); 377 if (wcform.length) { 378 wcform.find('input[type="password"]').closest(".woocommerce-FormRow").remove(); 379 wcform.find('input[name="login"]').remove(); 380 wcform.find(".woocommerce-LostPassword").remove(); 381 wcform.find('#rememberme').closest('label').remove(); 382 wcform.find("#username").attr('mob', 1); 383 384 if (wc_checkout.length) { 385 wc_checkout.find('input[type="password"]').closest('.woocommerce-form-row').remove(); 386 wc_checkout.find(".form-row-first").removeClass("form-row-first"); 387 wc_checkout.find(".lost_password").remove(); 388 wc_checkout.find('#rememberme').closest('label').remove(); 389 wc_checkout.find('[name="login"]').remove(); 390 wc_checkout.find("#username").attr('mob', 1); 391 } 392 } 393 394 var uc = jQuery("#dig_wc_check_page"); 395 if (uc.length) { 396 uc = uc.parent(); 397 var createAccounts = uc.find(".create-account"); 398 createAccount = createAccounts.last(); 399 if (createAccount.length) { 400 createAccount.find("#username").attr({'f-mob': 1, 'reg': 1, 'data-dig-mob': 1}); 401 if (dig_mdet.mobile_accept == 2) { 402 createAccount.find("#username").attr({'data-dig-mob': 1, 'data-type': 2}); 403 } 404 var wc_check_dig_fields = jQuery(".wc_check_dig_custfields"); 405 wc_check_dig_fields.appendTo(createAccount); 406 if (createAccounts.length === 1) { 407 wc_check_dig_fields.addClass('create-account') 408 } 409 } 410 } 411 var dismissLoader = false; 412 var dig_billing_password = jQuery("#billing_account_password"); 413 414//// Ultimate user 415 var um_register = jQuery(".um-register"); 416 if (um_register.length) { 417 um_register.find('.um-field-mobile_number').find('input').attr({ 418 'id': 'username', 419 'nan': '1', 420 'f-mob': 1 421 }).data('type', 2); 422 } 423 var um_login = jQuery(".um-login"); 424 if (um_login.length) { 425 if (um_login.find('.um-field-mobile_number').length) { 426 um_login.find('.um-field-mobile_number').remove(); 427 var um_username_field = um_login.find('.um-field-username'); 428 um_username_field.find('label').attr('for', 'username').text(dig_mdet.emailormobile); 429 um_username_field.find('input').attr({'id': 'username', 'nan': 1}); 430 um_login.find('.ump_digits_otp_container').show(); 431 } 432 } 433 434 var um_forgot = jQuery(".woocommerce-ResetPassword"); 435 if (um_forgot.length) { 436 var um_forgot_uname_field = um_forgot.find('.um-field-username_b'); 437 if (um_forgot_uname_field.length) { 438 um_forgot_uname_field.find('label').attr('for', 'username').text(dig_mdet.emailormobile); 439 um_forgot_uname_field.find('input').attr({'id': 'username', 'nan': 1}); 440 um_forgot.addClass('digits_um_forgotpass'); 441 } 442 } 443 444 var um_forgot_pass = 0; 445 jQuery('.digits_um_forgotpass #um-submit-btn').on('click', function () { 446 update_time_button = jQuery(this); 447 cuForm = jQuery(this).closest('form'); 448 var uname_field = cuForm.find('#username'); 449 var ccode_field = cuForm.find('.dig_wc_logincountrycode'); 450 var uname = uname_field.val(); 451 var ccode = ccode_field.val(); 452 if (isNumeric(uname)) { 453 454 if (um_forgot_pass == 3) { 455 var pass = jQuery("#dig_wc_password").val(); 456 var cpass = jQuery("#dig_wc_cpassword").val(); 457 if (pass != cpass) { 458 showDigErrorMessage(dig_mdet.Passwordsdonotmatch); 459 return false; 460 } 461 cuForm.attr({'action': '?login=true', 'method': 'post'}); 462 uname_field.attr('name', 'user'); 463 ccode_field.attr('name', 'dig_countrycodec'); 464 cuForm.find('#digit_ac_otp').attr('name', 'dig_otp'); 465 cuForm.unbind('submit').submit(); 466 return true; 467 } 468 469 if (um_forgot_pass == 2) { 470 verifyOtp(ccode, uname, nounce.val(), cuForm.find('#digit_ac_otp').val(), 3); 471 return false; 472 } 473 474 um_forgot_pass = 1; 475 prv_forg_wc = jQuery(this).val(); 476 jQuery(".dig_otp_um_reg").appendTo(cuForm.find('.um-field-text'));
477 verifyMobileNoLogin(ccode, uname, nounce.val(), 3); 478 479 return false; 480 } 481 }); 482 483 var wc_login_form = jQuery(".woocommerce-form-login"); 484 if (wc_login_form.length) { 485 if (dig_mdet.login_mobile_accept == 1 && dig_mdet.login_mail_accept == 0 && dig_mdet.login_uname_accept == 0) { 486 wc_login_form.find('#username').data('type', 2); 487 } 488 } 489 490 jQuery('input[id="username"],.digits_mobile_field,.digits_ext_phone_field').each(function (index) { 491 var $this = jQuery(this); 492 update_username_field($this); 493 }); 494 495 jQuery("#wc-pos-actions").find("#add_customer_to_register").on('click', function () { 496 setTimeout(function () { 497 update_username_field(jQuery('#username_field').find('#username')); 498 }, 100); 499 }); 500 501 function update_username_field($this) { 502 if (dig_mdet.login_mobile_accept == 0) { 503 var fmob = $this.attr('f-mob'); 504 505 if (!fmob || fmob == 0) return; 506 } 507 if (dig_mdet.mobile_accept == 0) { 508 var reg = $this.attr('reg'); 509 510 if (reg == 1) return; 511 } 512 var usernameid = $this; 513 514 var dig_main = usernameid.attr('data-dig-main'); 515 var ccd; 516 if (!dig_main) { 517 if ($this.attr('data-dig-mob') == 1) { 518 if ($this.attr('countryCode')) { 519 ccd = $this.attr('countryCode'); 520 } else { 521 ccd = dig_mdet.uccode; 522 } 523 524 } else if ($this.attr('mob') != 1) { 525 526 var lb = dig_mdet.emailormobile; 527 528 var reg = $this.attr('reg'); 529 530 if (!reg || reg == 0) { 531 reg = 0; 532 if (dig_mdet.login_mobile_accept > 0 && dig_mdet.login_mail_accept > 0) { 533 lb = dig_mdet.emailormobile; 534 } else if (dig_mdet.login_mobile_accept > 0) { 535 lb = dig_mdet.MobileNumber; 536 } else if (dig_mdet.login_mail_accept > 0) { 537 lb = dig_mdet.email; 538 } 539 } else if (reg == 1) { 540 if (dig_mdet.mobile_accept > 0 && dig_mdet.mail_accept > 0) { 541 lb = dig_mdet.emailormobile; 542 } else if (dig_mdet.mobile_accept > 0) { 543 lb = dig_mdet.MobileNumber; 544 } else if (dig_mdet.mail_accept > 0) { 545 lb = dig_mdet.email; 546 } 547 } 548 if (reg != 2) { 549 usernameid.prev().html(lb + " <span class=required>*</span>"); 550 if (usernameid.attr('placeholder')) usernameid.attr('placeholder', lb); 551 } 552 ccd = dig_mdet.uccode; 553 554 } else { 555 usernameid.prev().html(dig_mdet.MobileNumber + " <span class=required>*</span>"); 556 if (usernameid.attr('placeholder')) usernameid.attr('placeholder', dig_mdet.MobileNumber); 557 if ($this.attr('countryCode')) { 558 ccd = $this.attr('countryCode'); 559 } else { 560 ccd = dig_mdet.uccode; 561 } 562 563 } 564 } 565 566 var dig_ext = ""; 567 var dig_mainattr = ""; 568 569 var dig_ccd_name = "digt_countrycode"; 570 571 var dig_skip_label = $this.attr('data-skip-label'); 572 573 if (dig_skip_label) { 574 ccd = dig_mdet.uccode; 575 } else if (dig_main) { 576 var tc = $this.attr('countryCode'); 577 578 if (tc !== undefined) { 579 if (tc == -1) { 580 ccd = "+"; 581 } else { 582 ccd = "+" + tc; 583 } 584 } else { 585 ccd = dig_mdet.uccode; 586 } 587 dig_ext = "dig_update_hidden "; 588 dig_mainattr = 'data-dig-main="' + usernameid.attr('data-dig-main') + '"'; 589 dig_ccd_name = usernameid.attr('data-dig-main') + "_digt_countrycode"; 590 } 591 592 usernameid.wrap('<div class="digcon"></div>').before('<div class="dig_wc_countrycodecontainer dig_wc_logincountrycodecontainer">' + 593 '<input type="text" autocomplete="tel-country-code" name="' + dig_ccd_name + '" class="' + dig_ext + 'input-text countrycode dig_wc_logincountrycode" ' + 594 'value="' + ccd + '" maxlength="6" size="3" placeholder="' + ccd + '" ' + dig_mainattr + '/></div>'); 595 596 if (!usernameid.attr("nan")) usernameid.attr('name', "mobile/email"); 597 598 usernameid.on("keyup change focusin", function (e) { 599 var data_type = jQuery(this).data('type'); 600 var dclcc = jQuery(this).parent().find('.dig_wc_countrycodecontainer'); 601 var dcllInput = dclcc.find('input'); 602 603 var dig_main = jQuery(this).attr('data-dig-main'); 604 if (dig_main) { 605 var ccd_dig = jQuery(this).closest('.digcon').find(".dig_update_hidden"); 606 607 var con = filter_mobile(jQuery(this).val()); 608 var ccdval = ccd_dig.val(); 609 //ccdval = ccdval.replace("+", ""); 610 if (con.length > 0 && ccdval.length > 0) 611 jQuery('#' + dig_main).val(ccdval + "" + con); 612 else jQuery('#' + dig_main).val(""); 613 614 } 615 if (isNumeric(jQuery(this).val()) || jQuery(this).attr('only-mob') || data_type == 2) { 616 dclcc.css({"display": "inline-block"}); 617 618 dcllInput.trigger('keyup'); 619 if (jQuery(this).attr('data-show-btn')) { 620 jQuery("." + jQuery(this).attr('data-show-btn')).show(); 621 } 622 } else { 623 dclcc.hide(); 624 625 if (jQuery(this).attr('removeStyle')) jQuery(this).removeAttr('style'); 626 else jQuery(this).css({"padding-left": ""}); 627 628 if (jQuery(this).attr('data-show-btn')) { 629 if (dig_mdet.mobile_accept != 2) jQuery("." + jQuery(this).attr('data-show-btn')).hide(); 630 } 631 } 632 digit_validateLogin(jQuery(this)); 633 634 }); 635 636 setTimeout(function () { 637 usernameid.trigger('keyup'); 638 }, 10); 639 } 640 641 jQuery(".dig_update_hidden").on('keyup change focusin', function () { 642 var toUp = jQuery(this).attr("data-dig-main"); 643 var mob = jQuery(this).closest('.digcon').find("#username").val(); 644 645 mob = filter_mobile(mob); 646 var ccd = jQuery(this).val(); 647 // ccd = ccd.replace("+", ""); 648 /**/ 649 if (mob.length > 0 && ccd.length > 0) 650 jQuery('#' + toUp).val(custom_mersa_phone_prefix(ccd, mob)); 651 else jQuery('#' + toUp).val(""); 652 653 });
654 655 jQuery("#dokan-vendor-register").find("#reg_email").addClass('no-overwrite'); 656 jQuery(".woocommerce-EditAccountForm").find("#reg_email").addClass('no-overwrite'); 657 658 jQuery('input[id="reg_email"]').each(function (index) { 659 var reg_email = jQuery(this); 660 661 if (reg_email.hasClass('no-overwrite')) { 662 return; 663 } 664 665 var reg_input = reg_email.parent(); 666 667 var labe; 668 669 var req = " <span class=required>*</span>"; 670 if (dig_mdet.mail_accept == 1 && dig_mdet.mobile_accept == 1) { 671 labe = dig_mdet.emailormobile; 672 } else if (dig_mdet.mobile_accept > 0) { 673 labe = dig_mdet.MobileNumber; 674 reg_email.data('type', '2'); 675 reg_email.attr({'autocomplete': 'tel-national', 'name': 'tel_national'}); 676 if (dig_mdet.mobile_accept == 1) req = ' <span class=required>(' + dig_mdet.optional + ')</span>'; 677 } else if (dig_mdet.mail_accept == 1) { 678 labe = dig_mdet.email; 679 } else { 680 return; 681 } 682 683 reg_input.children("label").html(labe + req); 684 if (reg_email.attr('placeholder')) { 685 reg_email.attr('placeholder', labe); 686 } 687 688 reg_email.wrap('<div class="digcon"></div>') 689 .before('<div class="dig_wc_countrycodecontainer dig_wc_registercountrycodecontainer"><input type="text" name="digfcountrycode" class="input-text countrycode dig_wc_registercountrycode" value="' + dig_mdet.uccode + '" maxlength="6" size="3" placeholder="' + dig_mdet.uccode + '" autocomplete="tel-country-code"/></div>'); 690 691 reg_email.on("keyup change focusin", function (e) { 692 var data_type = jQuery(this).data('type'); 693 694 if (data_type == 3) return; 695 var dclcc = reg_input.find('.dig_wc_countrycodecontainer'); 696 var dcllInput = dclcc.find('input'); 697 if (isNumeric(reg_email.val()) || data_type == 2) { 698 dclcc.css({"display": "inline-block"}); 699 dcllInput.trigger('keyup'); 700 } else { 701 dclcc.hide(); 702 jQuery(this).css({"padding-left": "0.75em"}); 703 } 704 updateMailSecondLabel(reg_email); 705 }); 706 707 var parentForm = jQuery(this).closest('form'); 708 709 reg_email.attr({'type': 'text'}); 710 711 setTimeout(function () { 712 reg_email.trigger('keyup'); 713 }); 714 715 }); 716 717 user_login.parent().children("label").html(dig_mdet.emailormobile + " <span class=required>*</span>"); 718 719 jQuery('input[id="secondmailormobile"]').each(function (index) { 720 if (dig_mdet.mail_accept == 2 || dig_mdet.mobile_accept == 2) return; 721 sRegMail = jQuery(this); 722 sRegMail.addClass(); 723 sRegMail.wrap('<div class="digcon"></div>').before('<div class="dig_wc_countrycodecontainer dig_wc_registersecondcountrycodecontainer"><input type="text" name="digsfcountrycode2" class="input-text countrycode dig_wc_registersecondcountrycode" value="' + dig_mdet.uccode + '" maxlength="6" size="3" placeholder="' + dig_mdet.uccode + '" autocomplete="tel-country-code"/></div>'); 724 725 if (sRegMail.attr('placeholder')) sRegMail.attr('placeholder', dig_mdet.emailormobile); 726 sRegMail.on("keyup change focusin", function () { 727 728 var dclcc = jQuery(this).parent().find('.dig_wc_registersecondcountrycodecontainer'); 729 730 var dcllInput = dclcc.find('input'); 731 732 if (isNumeric(jQuery(this).val()) && !isNumeric(reg_email.val())) { 733 dclcc.css({"display": "inline-block"}); 734 dcllInput.trigger('keyup'); 735 736 } else { 737 dclcc.hide(); 738 jQuery(this).css({"padding-left": "0.75em"}); 739 } 740 }); 741 setTimeout(function () { 742 sRegMail.trigger('keyup'); 743 }); 744 }); 745 746 jQuery('.dig_wc_registersecondcountrycode').on("keyup change focusin", function (e) { 747 var dwccr = jQuery(this); 748 var code = dwccr.val(); 749 var size = code.length; 750 var curRegMail = dwccr.parent().parent().find('input#secondmailormobile'); 751 size++;
752 if (size < 2) size = 2; 753 dwccr.attr('size', size); 754 755 if (code.trim().length == 0) { 756 dwccr.val("+"); 757 } 758 curRegMail.css({"padding-left": mobilePaddingLeft(dwccr.outerWidth(false) + ew / 2 + "px")}, 'fast', function () { 759 }); 760 761 }); 762 763 if (!user_login.attr('disabled')) { 764 user_login.wrap('<div class="digcon"></div>').before('<div class="dig_wc_countrycodecontainer forgotcountrycodecontainer"><input type="text" name="dig_countrycodec" class="input-text countrycode forgotcountrycode" value="' + dig_mdet.uccode + '" maxlength="6" size="3" placeholder="' + dig_mdet.uccode + '"/></div>'); 765 766 setTimeout(function () { 767 user_login.trigger('keyup'); 768 }); 769 } 770 771 function digit_validateLogin(usernameid) { 772 var form = usernameid.closest('form'); 773 if (isNumeric(usernameid.val())) { 774 var dclcc = usernameid.parent().find('.dig_wc_countrycodecontainer').find('input'); 775 form.find("#loginuname").val(dclcc.val() + usernameid.val()); 776 } else { 777 778 form.find("#loginuname").val(usernameid.val()); 779 } 780 } 781 782 jQuery('.dig_wc_registercountrycode').on("keyup change focusin", function (e) { 783 var rccBox = jQuery(this); 784 var code = jQuery(this).val(); 785 var size = code.length; 786 var curRegMail = rccBox.parent().parent().find('input#reg_email'); 787 size++; 788 if (size < 2) size = 2; 789 rccBox.attr('size', size); 790 791 if (code.trim().length == 0) { 792 rccBox.val("+"); 793 } 794 curRegMail.css({"padding-left": mobilePaddingLeft(rccBox.outerWidth(false) + ew / 2 + "px")}, 'fast', function () { 795 }); 796 797 updateMailSecondLabel(curRegMail); 798 }); 799 800 user_login.on("keyup change focusin", function (e) { 801 802 if (isNumeric(jQuery(this).val())) { 803 jQuery(".forgotcountrycodecontainer").css({"display": "inline-block"}); 804 jQuery(".forgotcountrycode").trigger('keyup'); 805 } else { 806 jQuery(".forgotcountrycodecontainer").hide(); 807 jQuery(this).css({"padding-left": "0.75em"}); 808 } 809 }); 810 811 jQuery('.forgotcountrycode').on("keyup change focusin", function (e) { 812 var size = jQuery(this).val().length; 813 size++; 814 if (size < 2) size = 2; 815 816 jQuery(this).attr('size', size); 817 var code = jQuery(this).val(); 818 if (code.trim().length == 0) { 819 jQuery(this).val("+"); 820 } 821 822 user_login.css({"padding-left": mobilePaddingLeft(jQuery('.forgotcountrycode').outerWidth(true) + ew / 2 + "px")}, 'fast', function () { 823 }); 824 }); 825 826 var isSecondMailVisible = false; 827 var inftype = 0; 828 829 function updateMailSecondLabel(reg_email) { 830 831 var con = reg_email.val(); 832 833 var cPar = reg_email.closest('form'); 834 835 var digSecondCountryCode = cPar.find('.dig_wc_registersecondcountrycodecontainer'); 836 var regContainer = reg_email.parent(); 837 838 var secondmailormobile = cPar.find('.secondmailormobile'); 839 840 var mailSecondLabel = cPar.find("#dig_secHolder"); 841 842 if ((isNumeric(con) && inftype != 1) || dig_mdet.mail_accept == 2) { 843 inftype = 1; 844 mailSecondLabel.html(dig_mdet.email); 845 846 digSecondCountryCode.hide(); 847 848 secondmailormobile.css({"padding-left": "0.75em"}); 849 850 } else if (!isNumeric(con) && inftype != 2 && dig_mdet.mobile_accept != 2) { 851 inftype = 2; 852 mailSecondLabel.html(dig_mdet.MobileNumber); 853 854 digSecondCountryCode.css({"display": "inline-block"}); 855 856 secondmailormobile.css({"padding-left": mobilePaddingLeft(digSecondCountryCode.find(".dig_wc_registersecondcountrycode").outerWidth(false) + ew / 2 + "px")}); 857 } 858 859 if (dig_mdet.mail_accept != 2 && dig_mdet.mobile_accept != 2) { 860 861 if (con == "" || con.length == 0) { 862 cPar.find(".dig_wc_mailsecond").stop().slideUp(); 863 isSecondMailVisible = false; 864 return; 865 } 866 867 if (!isSecondMailVisible) { 868 cPar.find(".dig_wc_mailsecond").stop().slideDown().show(); 869 isSecondMailVisible = true; 870 } else return; 871 } 872 } 873 874 jQuery(document).on("keyup", ".dig_wc_logincountrycode", function (e) { 875 876 var rliBox = jQuery(this); 877 var code = rliBox.val(); 878 var size = code.length; 879 var container = rliBox.parent().parent(); 880 881 var curLogMail = container.find('#username'); 882 if (!curLogMail.length || !curLogMail) { 883 curLogMail = container.find('.digits_mobile_field'); 884 } 885 886 size++;
887 if (size < 2) size = 2; 888 rliBox.attr('size', size); 889 if (code.trim().length == 0) { 890 rliBox.val("+"); 891 } 892 curLogMail.attr("style", "padding-left:" + mobilePaddingLeft((rliBox.outerWidth(false) + ew / 2) + "px !important;")); 893 894 digit_validateLogin(curLogMail); 895 }); 896 897 var max = 5; 898 899 jQuery(".login .inline").each(function () { 900 var form = jQuery(this).closest('form'); 901 form.find('.woocommerce-LostPassword').prepend(jQuery(this)); 902 903 }); 904 905 var registerstatus = 0; 906 907 var regDone = 0; 908 register.find("input").on('focusout', function () { 909 if (regDone == 1) return; 910 register.find("input[type='submit']").each(function () { 911 jQuery(this).removeAttr("disabled").removeClass("disabled"); 912 }); 913 regDone = 0; 914 }); 915 916 var forgotDone = 0; 917 918 var forgotOutDone = 0; 919 920 jQuery(".woocommerce-ResetPassword input").on('focusin', function () { 921 if (forgotDone == 1) return; 922 jQuery(".woocommerce-ResetPassword input[type='submit'],.woocommerce-ResetPassword button[type='submit']").each(function () { 923 jQuery(this).removeAttr('disabled').removeClass("disabled"); 924 }); 925 forgotDone = 1; 926 }).on('focusout', function () { 927 if (forgotOutDone == 1) return; 928 jQuery(".woocommerce-ResetPassword input[type='submit'],.woocommerce-ResetPassword button[type='submit']").each(function () { 929 jQuery(this).removeAttr('disabled').removeClass("disabled"); 930 }); 931 forgotOutDone = 1; 932 }); 933 934 var loginDone = 0; 935 jQuery("form.login input").on('focusout', function () { 936 if (loginDone == 1) { 937 jQuery("form.login input[type='submit'],form.login button[type='submit']").each(function () { 938 jQuery(this).removeAttr("disabled").removeClass("disabled"); 939 }); 940 loginDone = 0; 941 } 942 }); 943 944 var curRegForm; 945 var passwcdo = 0; 946 947 if (dig_mdet.pass_accept != 2 && dig_mdet.mobile_accept > 0) { 948 register.find('input[id="reg_password"]').each(function () { 949 jQuery(this).closest('.woocommerce-form-row').hide(); 950 }); 951 } 952 953 register.find(".woocommerce-Button, button[name='register']").each(function () { 954 if (jQuery(this).attr('name') == 'register') { 955 if (!jQuery(this).hasClass("otp_reg_dig_wc")) { 956 if (jQuery(".otp_reg_dig_wc").length) 957 jQuery(this).val(dig_mdet.RegisterWithPassword).text(dig_mdet.RegisterWithPassword).addClass("wc_reg_pass_btn"); 958 } 959 } 960 }); 961 962 register.off(); 963 jQuery("#reg_password").on('change', function () { 964 jQuery(this).closest('form').find("[type='submit']").removeAttr('disabled'); 965 }); 966 register.find(".woocommerce-Button, button[name='register']").on('click', function (e) { 967 968 if (registerstatus == 1) return true; 969 curRegForm = jQuery(this).closest('form'); 970 971 var mail = jQuery.trim(curRegForm.find("#reg_email").val()); 972 var secmail = jQuery.trim(curRegForm.find("#secondmailormobile").val()); 973 974 if (jQuery(this).hasClass('otp_reg_dig_whatsapp')) { 975 useWhatsApp = 1; 976 lastmobileNo = -1; 977 lastDtype = 2; 978 } 979 980 jQuery(".dig_otp_submit_button").removeClass('dig_otp_submit_button'); 981 jQuery(this).addClass('dig_otp_submit_button'); 982 983 if (jQuery(this).hasClass("otp_reg_dig_wc")) { 984 if (!isNumeric(mail) && !isNumeric(secmail)) { 985 showDigNoticeMessage(dig_mdet.Thisfeaturesonlyworkswithmobilenumber); 986 return false; 987 } 988 989 curRegForm.find(".wc_reg_pass_btn").hide(); 990 curRegForm.find("#_wpnonce").parent().find("input[type='submit'],button[type='submit']").remove(); 991 } else if (passwcdo == 0) { 992 993 if (!curRegForm.find("#reg_billing_otp").is(":visible")) { 994 995 passwcdo = 1; 996 var a = curRegForm.find('#reg_password').closest('.woocommerce-form-row'); 997 if (a.css('display') == 'none') { 998 curRegForm.find(".otp_reg_dig_wc").hide(); 999 a.show(); 1000 return false; 1001 } 1002 } 1003 } 1004 });
1005 1006 function digits_wc_recaptcha_error(res) { 1007 loader.hide(); 1008 } 1009 1010 function digits_wc_recaptcha_callback(token) { 1011 curRegForm.find('.invi-recaptcha').last().attr('data-solved', 1); 1012 curRegForm.submit(); 1013 } 1014 1015 register.on('submit', function (e) { 1016 1017 hideDigMessage(); 1018 1019 if (registerstatus == 1) return true; 1020 1021 curRegForm = jQuery(this); 1022 update_time_button = register.find(".woocommerce-Button"); 1023 1024 var mail = jQuery.trim(curRegForm.find("#reg_email").val()); 1025 var secmail = jQuery.trim(curRegForm.find("#secondmailormobile").val()); 1026 1027 var passf = curRegForm.find("#reg_password"); 1028 1029 if (passf.length > 0) { 1030 var tpass = passf.val(); 1031 if (dig_mdet.strong_pass == 1) { 1032 if (dig_mdet.pass_accept == 2 || tpass.length > 0) { 1033 try { 1034 var strength = wp.passwordStrength.meter(tpass, ['black', 'listed', 'word'], tpass); 1035 if (strength != null && strength < 3) { 1036 showDigNoticeMessage(dig_mdet.useStrongPasswordString); 1037 return false; 1038 } 1039 } catch (e) { 1040 1041 } 1042 } 1043 } 1044 } 1045 1046 var custom_validation = validateCustomFields(curRegForm); 1047 1048 if (!custom_validation) { 1049 return false; 1050 } 1051 1052 var recaptcha = curRegForm.find('.invi-recaptcha').last(); 1053 if (recaptcha.length > 0 && !recaptcha.data('solved')) { 1054 var widget_id = grecaptcha.render(recaptcha.attr('id'), 1055 { 1056 'callback': digits_wc_recaptcha_callback, 1057 'error-callback': digits_wc_recaptcha_error, 1058 }); 1059 grecaptcha.execute(widget_id); 1060 return false; 1061 } 1062 1063 if (dig_mdet.mobile_accept == 0 && dig_mdet.mail_accept == 0) { 1064 return true; 1065 } 1066 1067 if (passf.length > 0) { 1068 var pass = passf.val(); 1069 if (!jQuery(this).hasClass("otp_reg_dig_wc") && passf.is(":visible")) { 1070 1071 if (pass.length == 0) { 1072 showDigErrorMessage(dig_mdet.invalidpassword); 1073 return false; 1074 } 1075 } 1076 if (pass.length == 0 && validateEmail(mail) && validateEmail(secmail) && !isNumeric(mail) && !isNumeric(secmail)) { 1077 showDigNoticeMessage(dig_mdet.eitherentermoborusepass); 1078 return false; 1079 } 1080 } 1081 1082 if (validateEmail(mail) && validateEmail(secmail) && secmail.length > 0) { 1083 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 1084 return false; 1085 } 1086 if (isNumeric(mail) && isNumeric(secmail) && secmail.length > 0) { 1087 showDigErrorMessage(dig_mdet.InvalidEmail); 1088 return false; 1089 } 1090 1091 var dig_reg_mail = curRegForm.find(".dig_reg_mail"); 1092 if (validateEmail(mail)) { 1093 dig_reg_mail.val(mail); 1094 } else if (validateEmail(secmail)) { 1095 dig_reg_mail.val(secmail); 1096 } 1097 1098 if (dig_mdet.mail_accept == 2 && (!validateEmail(dig_reg_mail.val()))) { 1099 showDigErrorMessage(dig_mdet.InvalidEmail); 1100 return false; 1101 } 1102 1103 if (dig_mdet.mobile_accept == 2 && !isNumeric(mail) && !isNumeric(secmail)) { 1104 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 1105 return false; 1106 } 1107 1108 var otp = jQuery("#reg_billing_otp"); 1109 1110 if (regverify == 1) { 1111 if (isNumeric(mail)) { 1112 verifyOtp(curRegForm.find(".dig_wc_registercountrycode").val(), mail, nounce.val(), otp.val(), 2); 1113 return false; 1114 } else if (isNumeric(secmail)) { 1115 verifyOtp(curRegForm.find(".dig_wc_registersecondcountrycode").val(), secmail, nounce.val(), otp.val(), 2); 1116 return false; 1117 } 1118 return false; 1119 } 1120 1121 if (curRegForm.find("#reg_username").length) { 1122 username_reg_field = curRegForm.find("#reg_username").val(); 1123 } 1124 if (curRegForm.find(".dig-custom-field-type-captcha").length) { 1125 captcha_reg_field = curRegForm.find(".dig-custom-field-type-captcha").find("input[type='text']").val(); 1126 captcha_ses_reg_field = curRegForm.find(".dig-custom-field-type-captcha").find(".dig_captcha_ses").val(); 1127 } 1128 akCallback = 'registerWooCallBack'; 1129 1130 if (isNumeric(mail)) { 1131 email_reg_field = secmail; 1132 verifyMobileNoLogin(curRegForm.find(".dig_wc_registercountrycode").val(), mail, nounce.val(), 2); 1133 email_reg_field = mail; 1134 return false; 1135 } else if (isNumeric(secmail)) { 1136 verifyMobileNoLogin(curRegForm.find(".dig_wc_registersecondcountrycode").val(), secmail, nounce.val(), 2); 1137 return false; 1138 } 1139 1140 });
1141 1142 function registerWooCallBack(response) { 1143 showDigitsLoader(true); 1144 if (response.status === "PARTIALLY_AUTHENTICATED") { 1145 registerstatus = 1; 1146 1147 var code = response.code; 1148 var csrf = response.state; 1149 curRegForm.find(".register_code").val(code); 1150 curRegForm.find(".register_csrf").val(csrf); 1151 curRegForm.find('[type="submit"]').click(); 1152 1153 } 1154 } 1155 1156 function validateEmail(email) { 1157 if ((email.search('@') >= 0) && (email.search(/\./) >= 0)) 1158 if (email.search('@') < email.split('@')[1].search(/\./) + email.search('@')) return true; 1159 else return false; 1160 else return false; 1161 } 1162 1163 var lastcountrycode, lastmobileNo, lastDtype; 1164 1165 var username_reg_field = ''; 1166 var email_reg_field = ''; 1167 var captcha_reg_field = ''; 1168 var captcha_ses_reg_field = ''; 1169 var isFirebase = 0; 1170 1171 function verifyMobileNoLogin(countrycode, mobileNo, csrf, dtype) { 1172 1173 otp_field = null; 1174 is_checkout = false; 1175 show_message = true; 1176 if (lastcountrycode == countrycode && lastmobileNo == mobileNo && lastDtype == dtype) { 1177 loader.hide(); 1178 return; 1179 } 1180 dismissLoader = false; 1181 1182 hideDigMessage(); 1183 1184 loader.show(); 1185 1186 if (lastDtype != dtype) { 1187 useWhatsApp = 0; 1188 } 1189 1190 if (update_time_button && update_time_button.hasClass('dig_wc_mobileWhatsApp')) { 1191 useWhatsApp = 1; 1192 } 1193 1194 lastcountrycode = countrycode; 1195 lastmobileNo = mobileNo; 1196 lastDtype = dtype; 1197 jQuery.ajax({ 1198 type: 'post', 1199 url: dig_mdet.ajax_url, 1200 data: { 1201 action: 'digits_check_mob', 1202 countrycode: countrycode, 1203 mobileNo: mobileNo, 1204 csrf: dig_mdet.nonce, 1205 login: dtype, 1206 username: username_reg_field, 1207 email: email_reg_field, 1208 captcha: captcha_reg_field, 1209 captcha_ses: captcha_ses_reg_field, 1210 json: 1, 1211 whatsapp: useWhatsApp 1212 }, 1213 success: function (res) { 1214 username_reg_field = ''; 1215 email_reg_field = ''; 1216 1217 captcha_reg_field = ''; 1218 captcha_ses_reg_field = ''; 1219 1220 lastDtype = 0; 1221 lastmobileNo = 0; 1222 1223 loader.hide(); 1224 1225 var ak = -1; 1226 1227 if (isJSON(res)) { 1228 if (res.success === false) { 1229 if (res.data.notice) { 1230 showDigNoticeMessage(res.data.message); 1231 } else { 1232 showDigErrorMessage(res.data.message); 1233 } 1234 return; 1235 } 1236 1237 ak = res.accountkit; 1238 isFirebase = res.firebase; 1239 res = res.code; 1240 } else { 1241 1242 res = res.trim(); 1243 } 1244 1245 if (res == -99) { 1246 showDigErrorMessage(dig_mdet.invalidcountrycode); 1247 return; 1248 } 1249 if (res == -11) { 1250 if (dtype == 1) { 1251 showDigNoticeMessage(dig_mdet.pleasesignupbeforelogginin); 1252 return; 1253 } else if (dtype == 3) { 1254 showDigErrorMessage(dig_mdet.Mobilenumbernotfound); 1255 return; 1256 } 1257 } else if (res == 0) { 1258 showDigErrorMessage(dig_mdet.error); 1259 return; 1260 } 1261 if ((res == -1 && dtype == 2) || (res == -1 && dtype == 11)) { 1262 showDigErrorMessage(dig_mdet.MobileNumberalreadyinuse); 1263 return; 1264 } 1265 1266 mobileNo = mobileNo.replace(/^0+/, ''); 1267 countrycode = countrycode.replace(/^0+/, ''); 1268 1269 if (ak == 1) { 1270 processAccountkitLogin(countrycode, mobileNo); 1271 } else if (isFirebase == 1) {
1272 dismissLoader = true; 1273 loader.show(); 1274 1275 var phone = countrycode + mobileNo; 1276 1277 if (countrycode == '+242' || countrycode == '+225') { 1278 phone = countrycode + '0' + mobileNo; 1279 } else { 1280 phone = countrycode + mobileNo; 1281 } 1282 1283 var appVerifier = window.recaptchaVerifier; 1284 firebase.auth().signInWithPhoneNumber(phone, appVerifier) 1285 .then(function (confirmationResult) { 1286 1287 loader.hide(); 1288 window.confirmationResult = confirmationResult; 1289 1290 verifyMobNo_success(res, countrycode, mobileNo, csrf, dtype); 1291 }).catch(function (error) { 1292 1293 if (error.message === 'TOO_LONG' || error.message === 'TOO_SHORT') { 1294 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 1295 } else { 1296 showDigErrorMessage(error.message); 1297 } 1298 loader.hide(); 1299 }); 1300 } else { 1301 verifyMobNo_success(res, countrycode, mobileNo, csrf, dtype); 1302 } 1303 } 1304 }); 1305 } 1306 1307 function processAccountkitLogin(countrycode, phoneNumber) { 1308 hideDigitsLoader(); 1309 1310 } 1311 1312 loader.on('click', function () { 1313 if (dismissLoader) loader.hide(); 1314 }); 1315 1316 function verifyMobNo_success(res, countrycode, mobileNo, csrf, dtype) { 1317 dismissLoader = false; 1318 1319 if (billing_page == 1) { 1320 digits_show_checkout_otp_modal(countrycode, mobileNo, csrf, dtype); 1321 } else if (dtype == 1) { 1322 if (res == 1) { 1323 1324 if (ihc_loginform == 1) { 1325 1326 ihc_loginform = 0; 1327 1328 updateTime(jQuery(".dig_impu_login_resend").attr({ 1329 "countrycode": countrycode, 1330 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1331 })); 1332 1333 var otpin = jQuery("#impu-dig-otp"); 1334 otpin.show().find("input").attr("required", "required").trigger('focus'); 1335 verifyimpuotp = 1; 1336 1337 } else if (subitumotp == 1) { 1338 1339 um_login.find(".digor").hide().remove(); 1340 um_login.find('.um-row').slideUp(); 1341 um_login.find('.um-col-alt').slideUp().remove(); 1342 um_login.find('.um-col-alt-b').hide().remove(); 1343 jQuery(".dig_otp_um_login").fadeIn().find("input").attr("required", "required").trigger('focus'); 1344 1345 subitumotp = 2; 1346 1347 tokenCon = um_login.find('form'); 1348 updateTime(jQuery(".dig_um_login_resend").attr({ 1349 "countrycode": countrycode, 1350 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1351 })); 1352 1353 } else { 1354 1355 updateTime(jQuery(".dig_wc_login_resend").attr({ 1356 "countrycode": countrycode, 1357 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1358 })); 1359 1360 hideloginpageitems(); 1361 logverify = 1; 1362 1363 cuForm.find('.dig_wc_mobileLogin').not('.dig_otp_submit_button').hide(); 1364 1365 var otpin = cuForm.find("#dig_wc_log_otp_container"); 1366 otpin.slideDown().find("input").attr("required", "required").trigger('focus'); 1367 jQuery("#username").closest("p").hide(); 1368 } 1369 1370 } 1371 } else if (dtype == 2) { 1372 1373 if (dig_bp_btn == 1) { 1374 1375 updateTime(jQuery(".dig_wcbil_bill_resend").attr({ 1376 "countrycode": countrycode, 1377 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1378 })); 1379 1380 var otpin = jQuery("#dig_bp_reg_otp"); 1381 otpin.show().find("input").attr("required", "required").trigger('focus'); 1382 verifybpotp = 1; 1383 dig_bp_btn = 0; 1384 1385 } else if (subitumotp == 1) { 1386 1387 var otpin = jQuery(".dig_otp_um_reg"); 1388 tokenCon = um_register.closest('form'); 1389 otpin.slideDown().find("input").attr("required", "required").trigger('focus'); 1390 subitumotp = 2; 1391 1392 updateTime(jQuery(".dig_um_regis_resend").attr({ 1393 "countrycode": countrycode, 1394 "mob": mobileNo, "csrf": csrf, "dtype": dtype
1395 })); 1396 1397 } else { 1398 1399 updateTime(jQuery(".dig_wc_register_resend").attr({ 1400 "countrycode": countrycode, 1401 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1402 })); 1403 1404 curRegForm.find(".form-row").find("input[type='password']").each(function () { 1405 jQuery(this).closest(".form-row").slideUp(); 1406 1407 }); 1408 curRegForm.find('.otp_reg_dig_wc').not('.dig_otp_submit_button').hide(); 1409 1410 var otpin = curRegForm.find("#reg_billing_otp_container"); 1411 otpin.slideDown().find("input").attr("required", "required").trigger('focus'); 1412 1413 regverify = 1; 1414 } 1415 1416 } else if (dtype == 3) { 1417 1418 if (forgotpassihc == 1) { 1419 1420 updateTime(jQuery(".dig_impu_forg_resend").attr({ 1421 "countrycode": countrycode, 1422 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1423 })); 1424 var otpin = jQuery("#impu-dig-otp"); 1425 otpin.show().find("input").attr("required", "required").trigger('focus'); 1426 forgotpassMobVerifiedihc = 1; 1427 forgotpassihc = 0; 1428 } else if (um_forgot_pass == 1) { 1429 updateTime(jQuery(".dig_um_regis_resend").attr({ 1430 "countrycode": countrycode, 1431 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1432 })); 1433 jQuery(".dig_otp_um_reg").show(); 1434 um_forgot_pass = 2; 1435 } else { 1436 updateTime(jQuery(".dig_wc_forgot_resend").attr({ 1437 "countrycode": countrycode, 1438 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1439 })); 1440 1441 forgverify = 1; 1442 user_login.attr('name', 'forgotmail'); 1443 var otpin = jQuery("#digit_forgot_otp_container"); 1444 otpin.show().find("input").attr("required", "required").trigger('focus'); 1445 } 1446 } else if (dtype == 11) { 1447 if (wpuseredit == 1) { 1448 1449 var otpin = curRegForm.find(".digits-edit-phone_otp-container"); 1450 tokenCon = curRegForm; 1451 otpin.slideDown().find("input").attr("required", "required").trigger('focus'); 1452 editverify = 1; 1453 1454 } else if (bpuseredit == 1) { 1455 var otpin = jQuery("#bp_otp_dig_ea"); 1456 otpin.slideDown().find("input").attr("required", "required").trigger('focus'); 1457 jQuery("#dig_bp_ac_ea_resend").show(); 1458 updateTime(jQuery(".dig_bp_ac_ea_resend").attr({ 1459 "countrycode": countrycode, 1460 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1461 })); 1462 bpeditverify = 1; 1463 } else if (ihcedform == 1) { 1464 var otpin = jQuery("#dig_ihc_mobotp"); 1465 tokenCon = otpin.closest('form'); 1466 otpin.slideDown().find("input").attr("required", "required").trigger('focus'); 1467 ihcedform = 2; 1468 } else { 1469 1470 updateTime(jQuery(".dig_wc_acc_edit_resend").attr({ 1471 "countrycode": countrycode, 1472 "mob": mobileNo, "csrf": csrf, "dtype": dtype 1473 })); 1474 var otpin = jQuery("#digit_ac_otp_container"); 1475 otpin.slideDown().find("input").attr("required", "required").trigger('focus'); 1476 editverify = 1; 1477 } 1478 } 1479 1480 digits_WaitForSms(); 1481 1482 } 1483 1484 var regverify = 0; 1485 var logverify = 0; 1486 var forgverify = 0; 1487 var editverify = 0; 1488 1489 function hideloginpageitems() { 1490 1491 var wp_login = jQuery(".wp_login"); 1492 if (cuForm.hasClass('wp_login')) { 1493 cuForm.find(".digor").remove(); 1494 cuForm.find("input[type='password']").parent().remove(); 1495 wp_login.children().each(function () { 1496 if (!jQuery(this).hasClass('dig_otp_block') && jQuery(this).find(".digcon").length === 0 && 1497 jQuery(this).find(".dig_bb_wp_otp_field").length === 0) { 1498 jQuery(this).hide(); 1499 } 1500 }); 1501 cuForm.find(".bbp-submit-wrapper").hide(); 1502 cuForm.append(cuForm.find(".dig_otp_block")); 1503 cuForm.find(".dig_otp_block").addClass('dig_otp_blk'); 1504 cuForm.find(".bbp-remember-me").hide(); 1505 return; 1506 } 1507 1508 cuForm.find(".digor").remove(); 1509 cuForm.find(".lost_password").hide(); 1510 cuForm.find("input[type='submit'],button[type='submit']").hide(); 1511 1512 cuForm.find(".dig-custom-field-type-captcha").hide(); 1513 1514 if (wc_checkout.length) { 1515 wc_checkout.find('input[type="password"]').parent().hide(); 1516 wc_checkout.find(".form-row-first").removeClass("form-row-first"); 1517 wc_checkout.find('#rememberme').closest('label').hide(); 1518 wc_checkout.find('[name="login"]').remove(); 1519 } 1520 jQuery('#cfw_login_modal_form .cfw-login-modal-navigation').hide(); 1521 1522 cuForm.find(".form-row").find("input[type='password']").each(function (index) { 1523 var mrow = jQuery(this).closest(".form-row"); 1524 if (index != 1 && mrow.attr('otp') != 1) 1525 mrow.remove(); 1526 else if (index == 1) { 1527 mrow.find("label").text(dig_mdet.MobileNumber + " *"); 1528 } 1529 1530 }); 1531 } 1532 1533 dig_login_wp_elem.on('submit', function () { 1534 if (logverify == 1) { 1535 jQuery(".dig_wc_mobileLogin").first().trigger('click'); 1536 return false; 1537 } 1538 1539 });
1540 var cuForm; 1541 1542 var nounce = jQuery(".dig_nounce"); 1543 jQuery(document).on('click', '.dig_wc_mobileLogin', function () { 1544 1545 update_time_button = jQuery(this); 1546 1547 cuForm = jQuery(this).closest('form'); 1548 var countryCode = cuForm.find(".countrycode").val(); 1549 1550 if (cuForm.find("#username").length > 0) { 1551 var phoneNumber = cuForm.find("#username").val(); 1552 } else if (cuForm.find("#user_login").length > 0) { 1553 var phoneNumber = cuForm.find("#user_login").val(); 1554 } else { 1555 var phoneNumber = cuForm.find(".digits_mobile_field").val(); 1556 } 1557 jQuery(".dig_otp_submit_button").removeClass('dig_otp_submit_button'); 1558 jQuery(this).addClass('dig_otp_submit_button'); 1559 1560 if (phoneNumber == "" || countryCode == "") { 1561 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 1562 return false; 1563 } 1564 1565 var otp = jQuery("#dig_wc_log_otp"); 1566 1567 if (dig_mdet.captcha_accept == 1) { 1568 1569 captcha_reg_field = cuForm.find("input[name='digits_reg_logincaptcha']").val(); 1570 if (captcha_reg_field != null) { 1571 captcha_ses_reg_field = cuForm.find(".dig-custom-field-type-captcha").find(".dig_captcha_ses").val(); 1572 if (captcha_reg_field.length == 0) { 1573 showDigErrorMessage("Please enter a valid captcha!"); 1574 return false; 1575 } 1576 } 1577 } 1578 1579 if (!isNumeric(countryCode) || !isNumeric(phoneNumber)) { 1580 var pass = cuForm.find("input[type='password']").val(); 1581 1582 if (pass != null) { 1583 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 1584 } 1585 return false; 1586 } 1587 1588 if (logverify == 1) { 1589 verifyOtp(countryCode, phoneNumber, nounce.val(), cuForm.find("#dig_wc_log_otp").val(), 1); 1590 return false; 1591 } 1592 1593 if (isNumeric(phoneNumber)) { 1594 akCallback = 'loginCallback'; 1595 1596 verifyMobileNoLogin(countryCode, phoneNumber, nounce.val(), 1); 1597 } 1598 1599 return false; 1600 }); 1601 1602 var updateProfileStatus = 0; 1603 1604 function updateProfileCallback(response) { 1605 showDigitsLoader(true); 1606 if (response.status === "PARTIALLY_AUTHENTICATED") { 1607 var code = response.code; 1608 var csrf = response.state; 1609 1610 updateProfileStatus = 1; 1611 1612 curRegForm.find("input[name='code']").val(code); 1613 curRegForm.find("input[name='csrf']").val(csrf); 1614 curRegForm.find("[type='submit']").click(); 1615 } else if (response.status === "NOT_AUTHENTICATED") { 1616 // handle authentication failure 1617 } else if (response.status === "BAD_PARAMS") { 1618 //Need to update this 1619 } 1620 1621 } 1622 1623 function updateCheckoutDetails(response) { 1624 showDigitsLoader(true); 1625 if (response.status === "PARTIALLY_AUTHENTICATED") { 1626 var code = response.code; 1627 var csrf = response.state; 1628 1629 jQuery(".dig_billing_otp_signup").hide(); 1630 1631 jQuery("#dig_wc_bill_code").val(code); 1632 jQuery("#dig_wc_bill_csrf").val(csrf); 1633 1634 } 1635 } 1636 1637 var prv_forg_wc = -1; 1638 jQuery("form.lost_reset_password input[type='submit'],form.lost_reset_password button[type='submit']").on('click', function () { 1639 update_time_button = jQuery(this); 1640 if (prv_forg_wc == -1) { 1641 if (jQuery(this).is(':input')) { 1642 prv_forg_wc = jQuery(this).val(); 1643 } else { 1644 prv_forg_wc = jQuery(this).text(); 1645 } 1646 } 1647 1648 if (forgotPassChange == 1) { 1649 var pass = jQuery("#dig_wc_password").val(); 1650 var cpass = jQuery("#dig_wc_cpassword").val(); 1651 if (pass != cpass) { 1652 showDigErrorMessage(dig_mdet.Passwordsdonotmatch); 1653 return false; 1654 } 1655 return true; 1656 } 1657 var mom = user_login.val(); 1658 var countryCode = jQuery("form.lost_reset_password .forgotcountrycode").val(); 1659 var otp = jQuery("#digit_forgot_otp"); 1660 1661 if (forgverify == 1) { 1662 verifyOtp(countryCode, mom, nounce.val(), otp.val(), 3); 1663 return false; 1664 } 1665 1666 if (isNumeric(mom)) { 1667 1668 jQuery("form.lost_reset_password").attr('action', window.location.pathname + "?login=true"); 1669 1670 akCallback = 'forgotPasswordCallBack'; 1671 verifyMobileNoLogin(countryCode, mom, nounce.val(), 3); 1672 1673 return false; 1674 } else { 1675 jQuery("form.lost_reset_password").removeAttr('action'); 1676 } 1677 return true; 1678 });
1679 1680 function forgotPasswordCallBack(response) { 1681 showDigitsLoader(true); 1682 if (response.status === "PARTIALLY_AUTHENTICATED") { 1683 var code = response.code; 1684 var csrf = response.state; 1685 forgotPassChange = 1; 1686 user_login.parent().parent().hide(); 1687 user_login.attr('name', 'forgotmail'); 1688 jQuery("#digits_wc_code").val(code); 1689 jQuery("#digits_wc_csrf").val(csrf); 1690 jQuery("form.lost_reset_password .changePassword").show(); 1691 } else if (response.status === "NOT_AUTHENTICATED") { 1692 // handle authentication failure 1693 } else if (response.status === "BAD_PARAMS") { 1694 //Need to update this 1695 } 1696 1697 } 1698 1699 var lastotpcountrycode, lastotpmobileNo, lastotpDtype; 1700 1701 function verifyOtp(countryCode, phoneNumber, csrf, otp, dtype) { 1702 otp = convert_number.toNormal(otp);/**/ 1703 dismissLoader = false; 1704 hideDigMessage(); 1705 if (show_message) { 1706 loader.show(); 1707 } 1708 1709 if (isFirebase == 1) verify_firebase_otp(countryCode, phoneNumber, csrf, otp, dtype); 1710 else verify_cust_otp(countryCode, phoneNumber, csrf, otp, dtype, -1); 1711 1712 } 1713 1714 function verify_firebase_otp(countryCode, phoneNumber, csrf, otp, dtype) { 1715 phoneNumber = phoneNumber.replace(/^0+/, ''); 1716 countryCode = countryCode.replace(/^0+/, ''); 1717 1718 if (otp == null || otp.length == 0) { 1719 loader.hide(); 1720 showDigErrorMessage(dig_mdet.InvalidOTP); 1721 return; 1722 } 1723 window.confirmationResult.confirm(otp) 1724 .then(function (result) { 1725 1726 firebase.auth().currentUser.getIdToken(true).then(function (idToken) { 1727 window.verifyingCode = false; 1728 window.confirmationResult = null; 1729 jQuery("#dig_ftok_fbase").remove(); 1730 tokenCon.append("<input type='hidden' name='dig_ftoken' value='" + idToken + "' id='dig_ftok_fbase' />"); 1731 verify_cust_otp(countryCode, phoneNumber, csrf, otp, dtype, idToken); 1732 }).catch(function (error) { 1733 loader.hide(); 1734 showDigErrorMessage(error); 1735 }); 1736 1737 }).catch(function (error) { 1738 loader.hide(); 1739 if (show_message) { 1740 showDigErrorMessage(dig_mdet.InvalidOTP); 1741 } 1742 add_otp_class(0, otp_field); 1743 1744 }); 1745 } 1746 1747 function verify_cust_otp(countryCode, phoneNumber, csrf, otp, dtype, idToken) { 1748 if (lastotpcountrycode == countryCode && lastotpmobileNo == phoneNumber && lastotpDtype == otp) { 1749 loader.hide(); 1750 return; 1751 } 1752 lastotpcountrycode = countryCode; 1753 lastotpmobileNo = phoneNumber; 1754 lastotpDtype = otp; 1755 1756 var rememberMe = 0; 1757 if (jQuery("#rememberme").length) { 1758 rememberMe = jQuery("#rememberme:checked").length > 0; 1759 } 1760 1761 jQuery.ajax({ 1762 type: 'post', 1763 url: dig_mdet.ajax_url, 1764 data: { 1765 action: 'digits_verifyotp_login', 1766 countrycode: countryCode, 1767 mobileNo: phoneNumber, 1768 otp: otp, 1769 dig_ftoken: idToken, 1770 csrf: csrf, 1771 dtype: dtype, 1772 rememberMe: rememberMe, 1773 }, 1774 success: function (res) { 1775 1776 if (isJSON(res)) { 1777 1778 if (!res.data) { 1779 res = res; 1780 } else { 1781 1782 if (res.data.error_msg) { 1783 loader.hide(); 1784 if (show_message) { 1785 if (res.data.error_type) { 1786 showDigMessage(res.data.error_msg, res.data.error_type); 1787 } else { 1788 showDigErrorMessage(res.data.error_msg); 1789 } 1790 } 1791 add_otp_class(0, otp_field); 1792 return; 1793 } 1794 1795 if (res.data.redirect) { 1796 showDigLoginSuccessMessage(); 1797 digits_redirect(res.data.redirect); 1798 return; 1799 } 1800 res = res.data.code; 1801 } 1802 } else { 1803 res = res.trim(); 1804 } 1805 1806 if (res != 11) loader.hide(); 1807 1808 if (res == 1011) { 1809 showDigErrorMessage(dig_mdet.error); 1810 return; 1811 } 1812 1813 if (res == 1013) { 1814 showDigErrorMessage(dig_mdet.error); 1815 return; 1816 } 1817 1818 if (res == -99) { 1819 showDigErrorMessage(dig_mdet.invalidcountrycode); 1820 return; 1821 } 1822 1823 if (res == 0) { 1824 1825 if (show_message) { 1826 showDigErrorMessage(dig_mdet.InvalidOTP); 1827 } 1828 1829 add_otp_class(0, otp_field); 1830 return; 1831 } else if (res == 11) { 1832 1833 if (ihcloginform.length || subitumotp > 0) { 1834 document.location.href = "/"; 1835 } else { 1836 showDigLoginSuccessMessage(); 1837 var redirect_to = jQuery('input[name="redirect_to"]'); 1838 if (redirect_to.length) { 1839 digits_redirect(redirect_to.first().val()); 1840 } else if (jQuery("#digits_redirect_page").length) { 1841 digits_redirect(jQuery("#digits_redirect_page").val()); 1842 } else digits_redirect(dig_mdet.uri); 1843 1844 } 1845 1846 return; 1847 } else if (res == -1 && dtype != 2 && dtype != 11 && dtype != 101) { 1848 showDigErrorMessage(dig_mdet.ErrorPleasetryagainlater); 1849 return; 1850 } else if ((res == 1 && dtype == 2) || (res == 1 && dtype == 11)) { 1851 showDigErrorMessage(dig_mdet.MobileNumberalreadyinuse); 1852 return; 1853 } 1854 if (is_checkout) { 1855 curRegForm.find('#dig_man_resend_otp_btn').hide(); 1856 digits_checkout_otp_verify_success(countryCode, phoneNumber,
1856csrf, otp, dtype, idToken); 1857 } else if (dtype == 2) { 1858 1859 if (verifybpotp == 1) { 1860 verifybpotp = 0; 1861 dig_bp_btn = 2; 1862 jQuery("#buddypress .signup-form").find("input[name='signup_submit']").click(); 1863 } else if (subitumotp == 2) { 1864 submitumform = 1; 1865 jQuery(".um-register").find("form").submit(); 1866 } else { 1867 registerstatus = 1; 1868 curRegForm.submit(); 1869 } 1870 1871 } else if (dtype == 3) { 1872 1873 if (forgotpassihc == 1) { 1874 1875 jQuery("#digits_password_ihc_cont").show().find("input").attr("required", "required"); 1876 jQuery("#digits_cpassword_ihc_cont").show().find("input").attr("required", "required"); 1877 forgotpassihc = 2; 1878 } else if (um_forgot_pass == 2) { 1879 um_forgot_pass = 3; 1880 cuForm.find('.um-field-text').hide(); 1881 cuForm.find('#dig_man_resend_otp_btn').hide(); 1882 cuForm.find('.changePassword').show(); 1883 update_time_button.val(prv_forg_wc); 1884 update_time_button.text(prv_forg_wc); 1885 1886 } else { 1887 forgotPassChange = 1; 1888 user_login.parent().parent().hide(); 1889 jQuery("#digit_forgot_otp_container").hide(); 1890 jQuery(".dig_wc_forgot_resend").hide(); 1891 user_login.attr('name', 'forgotmail'); 1892 jQuery("form.lost_reset_password .changePassword").show(); 1893 update_time_button.val(prv_forg_wc); 1894 update_time_button.text(prv_forg_wc); 1895 1896 } 1897 1898 } else if (dtype == 11) { 1899 1900 if (wpuseredit == 1) { 1901 updateProfileStatus = 1; 1902 curRegForm.find("[type='submit']").click(); 1903 1904 } else if (bpuseredit == 1) { 1905 jQuery("#buddypress").find("form").off("submit").submit(); 1906 } else if (ihcedform == 2) { 1907 submiticform = 1; 1908 jQuery(".ihc-form-create-edit").submit(); 1909 } else { 1910 updateAccountStatus = 1; 1911 jQuery("form.woocommerce-EditAccountForm").submit(); 1912 } 1913 1914 } 1915 1916 } 1917 }); 1918 } 1919 1920 var updateAccountStatus = 0; 1921 1922 jQuery("form.woocommerce-EditAccountForm input[type='submit'],form.woocommerce-EditAccountForm button[type='submit']").on('click', function () { 1923 1924 update_time_button = jQuery(this); 1925 1926 if (updateAccountStatus == 1) return true; 1927 1928 var curForm = jQuery(this).closest('form'); 1929 var oldMobile = curForm.find('#dig_wc_cur_phone').val(); 1930 var curMobile = curForm.find('.dig_wc_nw_phone').val(); 1931 var countryCode = curForm.find(".dig_wc_logincountrycode").val(); 1932 if (curMobile.length == 0) return true; 1933 1934 if (oldMobile == curMobile) return true; 1935 1936 if (isNumeric(curMobile)) { 1937 1938 var otp = jQuery("#digit_ac_otp"); 1939 1940 if (editverify == 1) { 1941 1942 verifyOtp(countryCode, curMobile, nounce.val(), otp.val(), 11); 1943 1944 return false; 1945 } 1946 1947 akCallback = 'updateAccountCallback'; 1948 verifyMobileNoLogin(countryCode, curMobile, nounce.val(), 11); 1949 1950 } else { 1951 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 1952 } 1953 return false; 1954 1955 }); 1956 1957 function updateAccountCallback(response) { 1958 showDigitsLoader(true); 1959 if (response.status === "PARTIALLY_AUTHENTICATED") { 1960 var code = response.code; 1961 var csrf = response.state; 1962 1963 updateAccountStatus = 1; 1964 1965 jQuery("form.woocommerce-EditAccountForm #dig_wc_prof_code").val(code); 1966 jQuery("form.woocommerce-EditAccountForm #dig_wc_prof_csrf").val(csrf); 1967 1968 jQuery("form.woocommerce-EditAccountForm input[type='submit'],form.woocommerce-EditAccountForm button[type='submit']").click(); 1969 } else if (response.status === "NOT_AUTHENTICATED") { 1970 // handle authentication failure 1971 } else if (response.status === "BAD_PARAMS") { 1972 //Need to update this 1973 } 1974 1975 } 1976 1977 var wpuseredit = 0; 1978 var edit_profile_form; 1979 1980 jQuery(document).on('keyup', '.digits-edit-phone_field input', function () { 1981 var form = jQuery(this).closest('form'); 1982 var phoneNumber = form.find(".mobile_number").val(); 1983 var countryCode = form.find(".dig_wc_logincountrycode").val(); 1984 1985 var m = countryCode + phoneNumber; 1986 var curPhone = form.find(".dig_cur_phone").val(); 1987 1988 if (phoneNumber.length == 0 || curPhone == m) { 1989 form.find('.digits_update_mobile_submit').attr('disabled', 'disabled'); 1990 } else { 1991 form.find('.digits_update_mobile_submit').removeAttr('disabled'); 1992 } 1993 1994 }) 1995 1996 jQuery("form#your-profile input[type='submit'],.digits_update_mobile_submit,form#your-profile button[type='submit']").on('click', function () { 1997 wpuseredit = 1; 1998 update_time_button = jQuery(this); 1999 curRegForm = jQuery(this).closest('form'); 2000 var is_digits_update = curRegForm.find('.digits_update_mobile'); 2001 if (updateProfileStatus == 1) return true; 2002 2003 if (dig_mdet.verify_mobile == 1 || is_digits_update.length) { 2004 2005 var phoneNumber = curRegForm.find(".mobile_number").val(); 2006 var countryCode = curRegForm.find(".dig_wc_logincountrycode").val(); 2007 2008 var m = countryCode + phoneNumber; 2009 var curPhone = curRegForm.find(".dig_cur_phone").val(); 2010 2011 if (phoneNumber.length == 0 || curPhone == m) { 2012 if (is_digits_update.length) { 2013 return false; 2014 } 2015 return true; 2016 } 2017 2018 var otp = curRegForm.find(".digits_otp_field"); 2019 2020 if (isNumeric(phoneNumber)) { 2021 2022 if (editverify == 1) { 2023 verifyOtp(countryCode, phoneNumber, nounce.val(), otp.val(), 11); 2024 return false; 2025 } 2026 akCallback = 'updateProfileCallback'; 2027 verifyMobileNoLogin(countryCode, phoneNumber, nounce.val(), 11); 2028 2029 } else { 2030 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2031 } 2032 2033 return false; 2034 } 2035 if (is_digits_update.length) return false; 2036 });
2037 2038 jQuery(document).on("click", "#dig_man_resend_otp_btn", function () { 2039 2040 var dbbtn = jQuery(this); 2041 if (!jQuery(this).hasClass("dig_resendotp_disabled")) { 2042 loader.show(); 2043 2044 if (isFirebase == 1) { 2045 dismissLoader = true; 2046 loader.show(); 2047 2048 var countrycode = dbbtn.attr("countrycode"); 2049 var phone; 2050 2051 if (countrycode == '+242' || countrycode == '+225') { 2052 phone = countrycode + '0' + dbbtn.attr("mob"); 2053 } else { 2054 phone = countrycode + dbbtn.attr("mob"); 2055 } 2056 2057 grecaptcha.reset(window.recaptchaWidgetId); 2058 2059 var appVerifier = window.recaptchaVerifier; 2060 firebase.auth().signInWithPhoneNumber(phone, appVerifier) 2061 .then(function (confirmationResult) { 2062 isDigFbAdd = 1; 2063 loader.hide(); 2064 window.confirmationResult = confirmationResult; 2065 updateTime(dbbtn); 2066 }).catch(function (error) { 2067 if (error.message === 'TOO_LONG' || error.message === 'TOO_SHORT') { 2068 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2069 } else { 2070 showDigErrorMessage(dig_mdet.Invaliddetails); 2071 } 2072 loader.hide(); 2073 }); 2074 2075 } else { 2076 jQuery.ajax({ 2077 type: 'post', 2078 url: dig_mdet.ajax_url, 2079 data: { 2080 action: 'digits_resendotp', 2081 countrycode: dbbtn.attr("countrycode"), 2082 mobileNo: dbbtn.attr("mob"), 2083 csrf: dbbtn.attr("csrf"), 2084 login: dbbtn.attr("dtype"), 2085 whatsapp: useWhatsApp 2086 }, 2087 success: function (res) { 2088 res = res.trim(); 2089 loader.hide(); 2090 if (res == 0) { 2091 showDigNoticeMessage(dig_mdet.Pleasetryagain); 2092 } else if (res == -99) { 2093 showDigErrorMessage(dig_mdet.invalidcountrycode); 2094 } else { 2095 updateTime(dbbtn); 2096 } 2097 } 2098 }); 2099 } 2100 } 2101 }); 2102 2103 var resendTime = dig_mdet.resendOtpTime; 2104 var update_time_button; 2105 2106 function updateTime(time) { 2107 2108 tokenCon = time.closest('form'); 2109 2110 if (update_time_button) { 2111 if (update_time_button.is('input')) { 2112 update_time_button.attr('value', dig_mdet.SubmitOTP); 2113 } else { 2114 update_time_button.text(dig_mdet.SubmitOTP); 2115 } 2116 } 2117 2118 time.attr("dis", 1).addClass("dig_resendotp_disabled").show().find("span").show(); 2119 var time_spam = time.find("span"); 2120 time_spam.text(convToMMSS(resendTime)); 2121 var counter = 0; 2122 var interval = setInterval(function () { 2123 var rem = resendTime - counter; 2124 time_spam.text(convToMMSS(rem)); 2125 counter++; 2126 2127 if (counter >= resendTime) { 2128 clearInterval(interval); 2129 time.removeAttr("dis").removeClass("dig_resendotp_disabled").find("span").hide(); 2130 counter = 0; 2131 } 2132 2133 }, 1000, true); 2134 } 2135 2136 function convToMMSS(timeInSeconds) { 2137 var sec_num = parseInt(timeInSeconds, 10); 2138 var hours = Math.floor(sec_num / 3600); 2139 var minutes = Math.floor((sec_num - (hours * 3600)) / 60); 2140 var seconds = sec_num - (hours * 3600) - (minutes * 60); 2141 2142 if (minutes < 10) { 2143 minutes = "0" + minutes; 2144 } 2145 if (seconds < 10) { 2146 seconds = "0" + seconds; 2147 } 2148 return "(" + minutes + ':' + seconds + ")"; 2149 } 2150 2151 jQuery(document.body).on('payment_method_selected', function () { 2152 var place_order = jQuery('#place_order').text(); 2153 }) 2154 2155 jQuery(document.body).on('updated_checkout', function (e) { 2156 }) 2157 2158 var verfiybilling = 0; 2159 var billing_page = 0; 2160 if ((jQuery('.woocommerce-checkout').length || jQuery("#checkout").length)) { 2161 var billing_otp_field = jQuery("#dig_billing_otp"); 2162 billing_otp_field.closest("p").hide(); 2163 2164 var regForm; 2165 var undigbill = jQuery(".woocommerce-checkout"); 2166 2167 var createAccount = undigbill.find(".create-account").last(); 2168 2169 jQuery(document).on('change', '#createaccount', function () { 2170 createAccount.find('.digcon #username').trigger('keyup'); 2171 }); 2172 2173 var digchbtn = "<input type='submit' class='dig_billing_otp_signup' onclick='verifyOTPbilling(1);return false;' value='" + dig_mdet.verifymobilenumber + "'/>"; 2174 2175 if (!(dig_billing_password.length && dig_mdet.pass_accept == 1)) { 2176 undigbill.attr('data-show-btn', 'dig_billing_otp_signup'); 2177 } 2178 2179 if (dig_mdet.mobile_accept == 2) { 2180 jQuery(".dig_billing_otp_signup").show(); 2181 } 2182 2183 /* createAccount.append("" + 2184 "<div class='dig_billing_wc_dv'>" + 2185 digchbtn + 2186 '</div><div class="dig_resendotp dig_wcbil_bill_resend" id="dig_man_resend_otp_btn" dis="1">' + dig_mdet.resendOTP + ' <span>(00:<span>30</span>)</span></div>' + 2187 "<a id='dig_billing_validate_button' style='display:none;'></a><a id='dig_billing_signupwithpassword' style='display:none;'></a><br /> ");*/ 2188 2189 var tasc = 0; 2190 2191 function digits_checkout_otp_verify_success(countryCode, phoneNumber,
2191csrf, otp, dtype, idToken) { 2192 var form = jQuery('form.checkout'); 2193 2194 if (!form.find('#digits_checkout_otp').length) { 2195 form.append('<input type="hidden" name="digit_ac_otp" id="digits_checkout_otp" />'); 2196 } 2197 form.find('#digits_checkout_otp').val(otp); 2198 2199 digits_process_checkout() 2200 } 2201 2202 function digits_show_checkout_otp_modal(countrycode, mobileNo, csrf, dtype) { 2203 var nonce = jQuery('#place_order').data('digits_verify'); 2204 loader.show() 2205 jQuery.ajax({ 2206 type: 'post', 2207 url: dig_mdet.ajax_url, 2208 data: { 2209 action: 'digits_wc_checkout_phone_verification_modal', 2210 _ajax_nonce: nonce, 2211 }, 2212 success: function (res) { 2213 var data = res.data; 2214 if (res.success) { 2215 jQuery('.digits_wc_checkout_phone_verification_modal').remove(); 2216 var html = jQuery(data.html); 2217 jQuery('body').append(html); 2218 html.find('input').focus().attr('dtype', dtype); 2219 } else { 2220 showDigErrorMessage(data.message) 2221 } 2222 loader.hide(); 2223 2224 }, 2225 error: function (res) { 2226 loader.hide(); 2227 } 2228 }); 2229 2230 } 2231 2232 jQuery(document).on('click', '.digits-checkout_phone_verification .digits-form_button', function (e) { 2233 var $this = jQuery(this); 2234 var form = jQuery('form.checkout'); 2235 otp_field = $this.closest('form').find('#digits_secure_billing_phone_otp'); 2236 var otp = otp_field.val(); 2237 var dtype = otp_field.attr('dtype'); 2238 unbpchk = form.find("#username"); 2239 curRegForm = form; 2240 is_checkout = true; 2241 2242 if (otp == null || otp.length == 0) { 2243 return false; 2244 } 2245 2246 if (isFirebase == 1 && otp.length != 6) { 2247 return false; 2248 } 2249 tokenCon = form; 2250 var phone = unbpchk.val(); 2251 var countrycode = form.find(".dig_wc_logincountrycode").val(); 2252 verifyOtp(countrycode, phone, nounce.val(), otp, dtype); 2253 2254 return false; 2255 }) 2256 2257 function digits_process_checkout() { 2258 jQuery('.digits_wc_checkout_phone_verification_modal').fadeOut('fast'); 2259 jQuery('form.checkout').trigger('submit'); 2260 } 2261 2262 jQuery(document).on('click', '.digits_wc_checkout_phone_verification_modal .digits_secure_modal-close', function (e) { 2263 var container = jQuery(this).closest('.digits_secure_modal_box'); 2264 container.fadeOut(); 2265 2266 return false; 2267 }) 2268 2269 jQuery(document).on('digits_process_wc_checkout', function () { 2270 var form = jQuery('form.checkout'); 2271 if(!form){ 2272 form = jQuery('#place_order').closest('form'); 2273 } 2274 2275 var create_verify_inp = form.find('#digits_vcustomer_phone'); 2276 2277 var dtype = 2; 2278 var verify = false; 2279 2280 if (!create_verify_inp.length) { 2281 if (dig_mdet.mob_verify_checkout == 1 && dig_mdet.mobile_accept > 0) { 2282 verify = true; 2283 } else { 2284 verify = false; 2285 } 2286 } else { 2287 var create_verify = create_verify_inp.val(); 2288 var payment_verify = form.find('#digits_vbill_phone').val(); 2289 var guest_verify = form.find('#digits_guest_vbill_phone').val(); 2290 2291 var createaccount = jQuery('input#createaccount'); 2292 2293 if (dig_mdet.mobile_accept > 0) { 2294 if (create_verify !== 'all') { 2295 if (create_verify === 'check') { 2296 verify = createaccount.is(':checked'); 2297 } 2298 } else { 2299 verify = true; 2300 } 2301 } 2302 2303 var payment_method = form.find('input[name="payment_method"]:checked').val(); 2304 2305 if (wc_checkout_params.option_guest_checkout === 'yes') { 2306 if (!verify && guest_verify !== 'none') { 2307 if (!createaccount.length || !createaccount.is(':checked')) { 2308 if (payment_method === 'cod' && guest_verify === 'cod') { 2309 verify = true; 2310 dtype = 101; 2311 } else if (guest_verify === 'all_methods') { 2312 verify = true; 2313 dtype = 101; 2314 } 2315 } 2316 } 2317 } 2318 2319 if (!verify && payment_verify !== 'none') { 2320 if (form.find('#digits_customer_checkout').length > 0 || (createaccount.length && createaccount.is(':checked'))) { 2321 if (payment_method === 'cod' && payment_verify === 'cod') { 2322 verify = true; 2323 dtype = 101; 2324 } else if (payment_verify === 'all_methods') { 2325 verify = true; 2326 dtype = 101; 2327 } 2328 2329 } 2330 } 2331 } 2332 2333 if (!verify || form.find('#digits_checkout_otp').length > 0) { 2334 digits_process_checkout(); 2335 return true; 2336 } 2337 2338 var $this = form.find('#place_order'); 2339 billing_page = 1; 2340 unbpchk = form.find("#username"); 2341 2342 var error = false; 2343 form.find('input').each(function () { 2344 var inp = jQuery(this); 2345 var val = inp.val(); 2346 if (inp.is(":visible") && val.length == 0) { 2347 var par = jQuery(this).closest('.form-row'); 2348 if (par.hasClass('validate-required')) { 2349 error = true; 2350 return true; 2351 } 2352 } 2353 }); 2354 2355 var custom_validation = validateCustomFields(createAccount); 2356 2357 if (!custom_validation || error) { 2358 showDigNoticeMessage(dig_mdet.fillAllDetails); 2359 return false; 2360 } 2361 2362 var termsCheckBox = form.find('#terms'); 2363 if (termsCheckBox.length > 0) { 2364 var termsCheckBoxChecked = termsCheckBox.prop('checked'); 2365 if (!termsCheckBoxChecked) { 2366 showDigErrorMessage(dig_mdet.accepttac); 2367 return false; 2368 } 2369 } 2370 2371 if (jQuery(".dig_opt_mult_con_tac").find('.dig_input_error').length) { 2372 showDigErrorMessage(dig_mdet.accepttac); 2373 return false; 2374 } 2375 2376 if (dig_log_obj.mobile_accept == 0 && dig_log_obj.mail_accept == 0) { 2377 digits_process_checkout(); 2378 return true; 2379 } 2380 2381 var phone = unbpchk.val(); 2382 var countrycode = form.find(".dig_wc_logincountrycode").val(); 2383 2384 if (!isNumeric(phone) && dig_mdet.mobile_accept != 2) { 2385 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2386 return false; 2387 } 2388 if (isNumeric(phone)) { 2389 akCallback = 'updateCheckoutDetails'; 2390 verifyMobileNoLogin(countrycode, phone, nounce.val(), dtype); 2391 2392 } else { 2393 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2394 return false; 2395 } 2396 }) 2397 2398 } 2399 2400 var unbpchk; 2401 var ihcloginform = jQuery("#ihc_login_form"); 2402 2403 var acur = window.location.href; 2404 acur = acur.substring(0, acur.indexOf('?')); 2405 2406 if (ihcloginform.length && dig_mdet.login_mobile_accept > 0) { 2407 var usernameihc = ihcloginform.find("#iump_login_username"); 2408 var passwordihc = ihcloginform.find("#iump_login_password"); 2409 usernameihc.attr("placeholder", dig_mdet.UsernameMobileno); 2410 2411 //ihcloginform.attr("action", acur + "?login=true"); 2412 2413 var ccd = dig_mdet.uccode; 2414 2415 ihcloginform.find("input[type='hidden']").val(dig_mdet.nonce).attr("name", "dig_nounce"); 2416 2417 ihcloginform.append("<input type='hidden' value='true' name='isimpc' />"); 2418 2419 usernameihc.wrap('<div class="digcon"></div>').before('<div class="dig_ihc_countrycodecontainer dig_ihc_logincountrycodecontainer" style="display: none;">' + 2420 '<input type="text" name="countrycode" class="input-text countrycode dig_ihc_logincountrycode" ' + 2421 'value="' + ccd + '" maxlength="6" size="3" placeholder="' + ccd + '" style="position: absolute;top:0;"/></div>'); 2422 2423 usernameihc.on("keyup change focusin", function (e) { 2424 if (isNumeric(jQuery(this).val())) { 2425 jQuery(".dig_ihc_logincountrycodecontainer").css({"display": "inline-block"}); 2426 jQuery(this).attr('style', "padding-left:" + mobilePaddingLeft((jQuery(".dig_ihc_logincountrycode").outerWidth(true) + 10) + "px !important")); 2427 } else { 2428 jQuery(".dig_ihc_logincountrycodecontainer").hide(); 2429 jQuery(this).removeAttr('style'); 2430 } 2431 }); 2432 2433 jQuery('<div class="impu-form-line-fr impu-dig-otp" id="impu-dig-otp" style="display: none;">' + 2434 '<input value="" id="digits_otp_ihc" name="digit_otp" placeholder="' + dig_mdet.OTP + '" type="tel" style="padding-left:10px !important;">') 2435 .insertBefore("#ihc_login_form .impu-form-submit"); 2436 2437 jQuery('.dig_ihc_logincountrycode').on("keyup change focusin", function (e) { 2438 var size = jQuery(this).val().length; 2439 size++;
2440 if (size < 2) size = 2; 2441 jQuery(this).attr('size', size); 2442 var code = jQuery(this).val(); 2443 if (code.trim().length == 0) { 2444 jQuery(this).val("+"); 2445 } 2446 usernameihc.attr('style', "padding-left:" + mobilePaddingLeft((jQuery(".dig_ihc_logincountrycode").outerWidth(true) + 10) + "px !important")); 2447 }); 2448 2449 jQuery('#ihc_login_form').off('submit'); 2450 2451 var remotp = 0; 2452 2453 if (!dig_mdet.secure_forms) { 2454 jQuery(document).on("click", "#impu_log_submit", function () { 2455 update_time_button = jQuery(this); 2456 cuForm = jQuery(this).closest('form'); 2457 2458 if (verifyimpuotp == 1) { 2459 verifyOtp(jQuery(".dig_ihc_logincountrycode").val(), usernameihc.val(), dig_mdet.nonce, jQuery("#digits_otp_ihc").val(), 1); 2460 return false; 2461 } 2462 2463 if (isNumeric(usernameihc.val())) { 2464 ihc_loginform = 1; 2465 2466 akCallback = 'loginCallback'; 2467 verifyMobileNoLogin(jQuery(".dig_ihc_logincountrycode").val(), usernameihc.val(), dig_mdet.nonce, 1); 2468 2469 if (remotp == 0) { 2470 remotp = 1; 2471 2472 ihcloginform.find("#digorimp").hide(); 2473 ihcloginform.find('.impu-form-submit').find("input:first").remove(); 2474 2475 ihcloginform.find("div").each(function (index) { 2476 if (index > 1) { 2477 if (!jQuery(this).hasClass("impu-form-submit") && !jQuery(this).hasClass("dig_ihc_logincountrycodecontainer") && !jQuery(this).hasClass("impu-dig-otp")) 2478 jQuery(this).hide(); 2479 } 2480 }); 2481 } 2482 } 2483 return false; 2484 }); 2485 if (dig_mdet.login_otp_accept > 0) {
2486 ihcloginform.find(".impu-form-submit").append("<div id='digorimp'> " + dig_mdet.or + "<br /><br /></div>" + 2487 "<input type='submit' id='impu_log_submit' value='" + dig_mdet.loginwithotp + "' />" + 2488 "<div class='dig_resendotp dig_impu_login_resend' id='dig_man_resend_otp_btn' dis='1'>" + dig_mdet.resendOTP + " <span>(00:<span>30</span>)</span></div></div>"); 2489 } 2490 } 2491 } 2492 var verifyimpuotp = 0; 2493 var ihc_loginform = 0; 2494 2495 var ihcforgotpasswrap = jQuery(".ihc-pass-form-wrap"); 2496 var ihforgaction = ihcforgotpasswrap.find("input[type='hidden']"); 2497 var forgotpassMobVerifiedihc = 0; 2498 var forgotpassihc = 0; 2499 if (ihforgaction.val() == "reset_pass" && dig_mdet.forgot_pass > 0) { 2500 2501 var ihcforgpassform = ihcforgotpasswrap.find("form"); 2502 2503 var ihcforgsub = ihcforgpassform.find("input[type='submit'],button[type='submit']"); 2504 2505 jQuery("<div class='dig_resendotp dig_impu_forg_resend' id='dig_man_resend_otp_btn' dis='1'>" + dig_mdet.resendOTP + " <span>(00:<span>30</span>)</span></div>") 2506 .insertAfter(ihcforgsub); 2507 2508 ihcforgpassform.append("<input type='hidden' name='dig_nounce' value='" + dig_mdet.nonce + "' /><input type='hidden' name='ihc' value='true' />"); 2509 2510 var ihcForgotUsername = ihcforgotpasswrap.find("input[type='text']"); 2511 2512 ihcforgpassform.on('submit', function (e) { 2513 update_time_button = jQuery(this); 2514 if (forgotpassihc == 2) { 2515 var pass = jQuery("#digits_password_ihc").val(); 2516 var cpass = jQuery("#digits_cpassword_ihc").val(); 2517 if (pass != cpass) { 2518 showDigErrorMessage(dig_mdet.Passwordsdonotmatch); 2519 return false; 2520 } 2521 ihcforgpassform.off('submit').submit(); 2522 return; 2523 } 2524 forgotpassihc = 1; 2525 if (isNumeric(ihcForgotUsername.val())) { 2526 2527 ihcforgpassform.attr("action", acur + "?login=true"); 2528 ihcForgotUsername.attr("name", "forgotmail"); 2529 2530 var countrycode = jQuery(".dig_ihc_forgotcountrycode").val(); 2531 2532 akCallback = 'forgotihcCallback'; 2533 2534 if (forgotpassMobVerifiedihc == 0) { 2535 verifyMobileNoLogin(countrycode, ihcForgotUsername.val(), dig_mdet.nonce, 3); 2536 } else { 2537 forgotpassihc = 1; 2538 verifyOtp(countrycode, ihcForgotUsername.val(), dig_mdet.nonce, jQuery("#digits_otp_forg_ihc").val(), 3) 2539 2540 } 2541 2542 return false; 2543 } 2544 ihcForgotUsername.attr("name", "email_or_userlogin"); 2545 ihcforgpassform.removeAttr("action"); 2546 return true; 2547 2548 }); 2549 2550 var ccd = dig_mdet.uccode; 2551 2552 ihcForgotUsername.wrap('<div class="digcon"></div>').before('<div class="dig_ihc_forgot_countrycodecontainer dig_ihc_forgot_logincountrycodecontainer" style="display: none;">' + 2553 '<input type="text" name="countrycode" class="input-text countrycode dig_ihc_forgotcountrycode" ' + 2554 'value="' + ccd + '" maxlength="6" size="3" placeholder="' + ccd + '" style="position: absolute;top:0;"/></div>'); 2555 ihcForgotUsername.attr("placeholder", dig_mdet.UsernameMobileno); 2556 2557 jQuery( 2558 '<div class="impu-form-line-fr" id="digits_password_ihc_cont" style="display: none;"><input value="" id="digits_password_ihc" name="digits_password" placeholder="' + dig_mdet.Password + '" type="password" style="padding-left:10px !important;"></div>' + 2559 '<div class="impu-form-line-fr" id="digits_cpassword_ihc_cont" style="display: none;"><input value="" id="digits_cpassword_ihc" name="digits_cpassword" placeholder="' + dig_mdet.ConfirmPassword + '" type="password" style="padding-left:10px !important;"></div>') 2560 .insertAfter(ihcForgotUsername.closest(".impu-form-line-fr")); 2561 2562 jQuery('<div class="impu-form-line-fr impu-dig-otp" id="impu-dig-otp" style="display: none;"><input value="" id="digits_otp_forg_ihc" name="dig_otp" placeholder="' + dig_mdet.OTP + '" type="tel" style="padding-left:10px !important;" autocomplete="one-time-code"></div>') 2563 .insertAfter(ihcForgotUsername.closest(".impu-form-line-fr")); 2564 2565 jQuery('<input type="hidden" name="code" id="digits_impu_code"/><input type="hidden" name="csrf" id="digits_impu_csrf"/>') 2566 .insertAfter(ihcForgotUsername.closest(".impu-form-line-fr")); 2567 2568 ihcForgotUsername.on("keyup change focusin", function (e) { 2569 if (isNumeric(jQuery(this).val())) { 2570 jQuery(".dig_ihc_forgot_countrycodecontainer").css({"display": "inline-block"}); 2571 jQuery(this).attr('style', "padding-left:" + mobilePaddingLeft((jQuery(".dig_ihc_forgotcountrycode").outerWidth(true) + 10) + "px !important")); 2572 2573 } else { 2574 jQuery(".dig_ihc_forgot_countrycodecontainer").hide(); 2575 jQuery(this).removeAttr('style'); 2576 2577 } 2578 }); 2579 2580 jQuery('.dig_ihc_forgotcountrycode').on("keyup change focusin", function (e) { 2581 var size = jQuery(this).val().length; 2582 size++;
2583 if (size < 2) size = 2; 2584 jQuery(this).attr('size', size); 2585 var code = jQuery(this).val(); 2586 if (code.trim().length == 0) { 2587 jQuery(this).val("+"); 2588 } 2589 ihcForgotUsername.attr('style', "padding-left:" + mobilePaddingLeft((jQuery(".dig_ihc_forgotcountrycode").outerWidth(true) + 10) + "px !important")); 2590 }); 2591 2592 } 2593 2594 function mobilePaddingLeft(value) { 2595 if (dig_mdet.dig_hide_ccode == 1) { 2596 return '0.75em'; 2597 } else { 2598 return value; 2599 } 2600 } 2601 2602 if (jQuery(".dig_bp_enb").length) { 2603 jQuery(".dig_bp_enb").each(function (index) { 2604 jQuery(this).remove(); 2605 }); 2606 } 2607 var dig_bp_btn = 0; 2608 var verfiyBPReg = 0; 2609 2610 jQuery(document).on("click", "#signup_submit_pass_bp", function () { 2611 if (verfiyBPReg == 1) return true; 2612 verfiyBPReg = 1; 2613 var bpForm = jQuery("#buddypress").find("form"); 2614 2615 bpForm.find("#dig_reg_bp_pass").show().find("input").attr("required", "required"); 2616 bpForm.find("#signup_submit_otp_bp").hide(); 2617 return false; 2618 }); 2619 2620 jQuery("#buddypress").find('#signup-form,#signup_form').addClass('signup-form'); 2621 jQuery("#buddypress .signup-form").on('submit', function () { 2622 update_time_button = jQuery(this).find('input[name="signup_submit"]'); 2623 if (dig_bp_btn == 2) return true; 2624 dig_bp_btn = 1; 2625 2626 var bpForm = jQuery(this); 2627 tokenCon = bpForm; 2628 var phone = bpForm.find("#username").val(); 2629 var countrycode = bpForm.find(".dig_wc_logincountrycode").val(); 2630 var otp = jQuery("#dig_bp_reg_otp"); 2631 2632 var pass = bpForm.find("#signup_password").val(); 2633 2634 if (dig_mdet.strong_pass == 1) { 2635 if (dig_mdet.pass_accept == 2 || pass.length > 0) { 2636 var strength = wp.passwordStrength.meter(pass, ['black', 'listed', 'word'], pass); 2637 if (strength != null && strength < 3) { 2638 showDigNoticeMessage(dig_mdet.useStrongPasswordString); 2639 return false; 2640 } 2641 } 2642 } 2643 2644 if (verifybpotp == 1) { 2645 verifyOtp(countrycode, phone, nounce.val(), otp.find("input").val(), 2); 2646 } else if (phone.length == 0) { 2647 showDigNoticeMessage(dig_mdet.pleaseentermobormail); 2648 } else if (pass.length == 0 && !isNumeric(phone)) { 2649 showDigNoticeMessage(dig_mdet.eitherentermoborusepass); 2650 } else if (isNumeric(phone)) { 2651 2652 if (bpForm.find("#signup_submit_otp_bp").is(':visible')) bpForm.find("#signup_submit_pass_bp").remove(); 2653 2654 akCallback = 'updateRegisterDetails'; 2655 verifyMobileNoLogin(countrycode, phone, nounce.val(), 2); 2656 2657 } else if (validateEmail(phone)) { 2658 return true; 2659 } else { 2660 showDigErrorMessage(dig_mdet.Invaliddetails); 2661 } 2662 return false; 2663 }); 2664 2665 var verifybpotp = 0; 2666 2667 function updateRegisterDetails(response) { 2668 showDigitsLoader(true); 2669 if (response.status === "PARTIALLY_AUTHENTICATED") { 2670 var code = response.code; 2671 var csrf = response.state; 2672 2673 jQuery("#dig_bp_reg_code").val(code); 2674 jQuery("#dig_bp_reg_csrf").val(csrf); 2675 dig_bp_btn = 2; 2676 jQuery("#buddypress").find("form").submit(); 2677 } 2678 } 2679 2680 var bpuseredit = 0; 2681 var bpeditverify = 0; 2682 2683 jQuery("#buddypress").find("form#settings-form").on('submit', function () { 2684 update_time_button = jQuery(this).find('[type="submit"]'); 2685 var form = jQuery(this); 2686 tokenCon = form; 2687 var uname = form.find("#username").val(); 2688 var ccode = form.find(".dig_wc_logincountrycode").val(); 2689 2690 if (jQuery("#dig_superadmin").length) return true; 2691 2692 if (isNumeric(uname)) { 2693 if (uname == form.find("#dig_bp_current_mob")) return true; 2694 if (bpeditverify == 1) { 2695 var otp = jQuery("#bp_otp_dig_ea"); 2696 verifyOtp(ccode, uname, nounce.val(), otp.find("input").val(), 11); 2697 } else { 2698 bpuseredit = 1; 2699 akCallback = 'updateBPAccountDetails'; 2700 2701 verifyMobileNoLogin(ccode, uname, nounce.val(), 11); 2702 2703 } 2704 } else return true; 2705 return false; 2706 });
2707 2708 function updateBPAccountDetails(response) { 2709 showDigitsLoader(true); 2710 if (response.status === "PARTIALLY_AUTHENTICATED") { 2711 var code = response.code; 2712 var csrf = response.state; 2713 2714 jQuery("#dig_bp_ea_code").val(code); 2715 jQuery("#dig_bp_ea_csrf").val(csrf); 2716 dig_bp_btn = 2; 2717 jQuery("#buddypress").find("form").off("submit").submit(); 2718 } 2719 } 2720 2721 if (dig_mdet.login_mobile_accept !== 0) { 2722 var bb_wp_lform = jQuery(".wp_login"); 2723 if (dig_mdet.login_mail_accept == 0 && dig_mdet.login_uname_accept == 0) { 2724 bb_wp_lform.find('#username').data('type', 2); 2725 } 2726 if (!bb_wp_lform.length) { 2727 bb_wp_lform = jQuery(".wp-core-ui #loginform"); 2728 bb_wp_lform.addClass('wp_login'); 2729 } 2730 if (!dig_mdet.secure_forms) { 2731 if (bb_wp_lform.length && dig_mdet.login_otp_accept > 0) { 2732 bb_wp_lform.addClass('digits'); 2733 bb_wp_lform.find("[type='submit']").parent().append("<div class='dig_otp_block'><div class='digor'> " + dig_mdet.or + "<br /><br /></div>" + 2734 "<input type='submit' class='dig_wc_mobileLogin button button-primary button-large' id='wp_bb_log_submit' value='" + dig_mdet.loginwithotp + "' />" + 2735 "<div class='dig_resendotp dig_wc_login_resend dig_bb_login_resend' id='dig_man_resend_otp_btn' dis='1'>" + dig_mdet.resendOTP + " <span>(00:<span>30</span>)</span></div></div></div>"); 2736 } 2737 } 2738 } 2739 jQuery(".wp_reg").on('submit', function () { 2740 2741 if (registerstatus == 1) return true; 2742 2743 update_time_button = jQuery(this).find("[type='submit']"); 2744 curRegForm = jQuery(this); 2745 tokenCon = curRegForm; 2746 var mobile = formatMobileNumber(curRegForm.find("#username").val()); 2747 var ccode = curRegForm.find(".dig_wc_logincountrycode").val(); 2748 2749 var custom_validation = validateCustomFields(curRegForm); 2750 2751 if (!custom_validation) { 2752 return false; 2753 } 2754 2755 if (dig_mdet.mobile_accept == 0) { 2756 return true; 2757 } 2758 2759 if (!isNumeric(mobile) || !isNumeric(ccode) || ccode.length == 0 || mobile.length == 0) { 2760 if (mobile.length == 0 && dig_mdet.mobile_accept == 1) { 2761 return true; 2762 } 2763 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2764 return false; 2765 } 2766 2767 var otp = jQuery("#reg_billing_otp"); 2768 2769 if (regverify == 1) { 2770 verifyOtp(ccode, mobile, nounce.val(), otp.val(), 2); 2771 return false; 2772 } 2773 2774 if (curRegForm.find("#user_uname").length) { 2775 username_reg_field = curRegForm.find("#user_uname").val(); 2776 } 2777 if (curRegForm.find(".dig-custom-field-type-captcha").length) { 2778 captcha_reg_field = curRegForm.find(".dig-custom-field-type-captcha").find("input[type='text']").val(); 2779 captcha_ses_reg_field = curRegForm.find(".dig-custom-field-type-captcha").find(".dig_captcha_ses").val(); 2780 } 2781 email_reg_field = curRegForm.find("#user_email").val(); 2782 2783 akCallback = 'registerWooCallBack'; 2784 verifyMobileNoLogin(ccode, mobile, nounce.val(), 2); 2785 2786 return false; 2787 2788 }); 2789 2790 function updateIHCAccountDetails(response) { 2791 showDigitsLoader(true); 2792 if (response.status === "PARTIALLY_AUTHENTICATED") { 2793 var code = response.code; 2794 var csrf = response.state; 2795 2796 jQuery("#dig_ihc_ea_code").val(code); 2797 jQuery("#dig_ihc_ea_csrf").val(csrf); 2798 submiticform = 1; 2799 jQuery(".ihc-form-create-edit").submit(); 2800 } 2801 } 2802 2803 var submiticform = 0; 2804 var ihcedform = 0; 2805 if (c.length) { 2806 2807 var e = jQuery("#dig_ihc_mobcon"); 2808 2809 if (jQuery(".iump-register-form").find("#edituser").length && dig_mdet.mobile_accept > 0) { 2810 jQuery(c).prepend(e); 2811 jQuery(e.find("#dig_ihc_mobotp")).insertBefore(c.find("input[type='submit'],button[type='submit']").closest('.iump-submit-form'));
2812 } 2813 2814 jQuery(".ihc-form-create-edit input[type=submit]").on('click', function () { 2815 update_time_button = jQuery(this); 2816 var form = jQuery(".ihc-form-create-edit"); 2817 2818 if (submiticform == 1 || !form.find("#username").length) return true; 2819 var mob = form.find("#username").val(); 2820 var ccode = form.find(".dig_wc_logincountrycode").val(); 2821 2822 if (mob == form.find("#dig_ihc_current_mob").val()) return true; 2823 2824 if (isNumeric(mob)) { 2825 if (ihcedform == 2) { 2826 var otp = form.find("#dig_ihc_mobotp"); 2827 verifyOtp(ccode, mob, nounce.val(), otp.find("input").val(), 11); 2828 2829 } else { 2830 akCallback = 'updateIHCAccountDetails'; 2831 2832 ihcedform = 1; 2833 verifyMobileNoLogin(ccode, mob, nounce.val(), 11); 2834 } 2835 2836 } else if (mob.length > 0) { 2837 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2838 } else return true; 2839 return false; 2840 }) 2841 } 2842 2843 var submitumform = 0; 2844 var subitumotp = 0; 2845 2846 um_register.find("form").on('submit', function () { 2847 2848 update_time_button = jQuery(this).find('#um-submit-btn'); 2849 if (submitumform == 1) return true; 2850 var form = jQuery(this); 2851 var uid = form.find("#username").val(); 2852 var ccode = form.find(".dig_wc_logincountrycode").val(); 2853 var c = form.find(".dig_otp_um_reg"); 2854 if (!uid) return true; 2855 if (form.find("#um_sub").length > 0) { 2856 return true; 2857 } 2858 2859 var custom_validation = validateCustomFields(form); 2860 if (!custom_validation) { 2861 return false; 2862 } 2863 2864 if (!isNumeric(uid)) { 2865 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2866 return false; 2867 } 2868 loader.show(); 2869 2870 uid = formatMobileNumber(uid); 2871 2872 akCallback = 'submitUMRegform'; 2873 2874 if (subitumotp == 2) { 2875 verifyOtp(ccode, uid, nounce.val(), c.find("input").val(), 2); 2876 } else { 2877 2878 subitumotp = 1; 2879 verifyMobileNoLogin(ccode, uid, nounce.val(), 2); 2880 } 2881 2882 jQuery(".um-register").find("input[type='submit'],button[type='submit']").removeAttr('disabled'); 2883 return false; 2884 }); 2885 2886 jQuery(".dig_um_loginviaotp").on('click', function () { 2887 update_time_button = jQuery(this); 2888 var phoneNumber = um_login.find("#username").val(); 2889 var csrf = jQuery(".dig_nounce").val(); 2890 var countryCode = um_login.find(".dig_wc_logincountrycode").val(); 2891 if (phoneNumber == "" || countryCode == "") { 2892 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2893 return false; 2894 } 2895 var otpin = jQuery(".dig_otp_um_login"); 2896 2897 if (!isNumeric(phoneNumber) || !isNumeric(phoneNumber)) { 2898 showDigErrorMessage(dig_mdet.InvalidMobileNumber); 2899 return false; 2900 } 2901 2902 if (subitumotp == 2) { 2903 verifyOtp(countryCode, phoneNumber, csrf, otpin.find("input").val(), 1); 2904 return false; 2905 } 2906 if (isNumeric(phoneNumber)) { 2907 2908 akCallback = 'loginCallback'; 2909 2910 subitumotp = 1; 2911 verifyMobileNoLogin(countryCode, phoneNumber, csrf, 1); 2912 2913 } else if (phoneNumber.length > 0) { 2914 showDigNoticeMessage(dig_log_obj.Thisfeaturesonlyworkswithmobilenumber); 2915 } else { 2916 akCallback = 'loginCallback'; 2917 2918 verifyMobileNoLogin(countryCode, phoneNumber, csrf); 2919 2920 } 2921 return false; 2922 2923 }); 2924 2925 function submitUMRegform(response) { 2926 showDigitsLoader(true); 2927 if (response.status === "PARTIALLY_AUTHENTICATED") { 2928 var code = response.code; 2929 var csrf = response.state; 2930 2931 jQuery("#digits_um_code").val(code); 2932 jQuery("#digits_um_csrf").val(csrf); 2933 submitumform = 1; 2934 jQuery(".um-register").find("form").submit(); 2935 } 2936 } 2937 2938 if (jQuery("#dig_reg_mail").length > 0) { 2939 if (jQuery("#reg_email").attr('placeholder') != '' && jQuery("#reg_email").attr('placeholder') != null) { 2940 var fn_pld = jQuery("#reg_billing_first_name"); 2941 fn_pld.attr('placeholder', jQuery.trim(fn_pld.parent().find('label').text())); 2942 register.find('.dig-custom-field').each(function () { 2943 2944 var lb = jQuery.trim(jQuery(this).find('label').text()); 2945 if (lb) jQuery(this).find('input').attr('placeholder', lb); 2946 2947 }); 2948 } 2949 } 2950 2951 function formatMobileNumber(number) { 2952 return number.replace(/^0+/, ''); 2953 } 2954 2955 function validateCustomFields(form) { 2956 var error = false; 2957 2958 if (form.attr('wait')) { 2959 showDigNoticeMessage(form.attr('wait'));
2960 return false; 2961 } 2962 2963 if (form.attr('error')) { 2964 showDigErrorMessage(form.attr('error')); 2965 return false; 2966 } 2967 2968 form.find('input,textarea,select').each(function () { 2969 if ((jQuery(this).attr('required') && jQuery(this).is(":visible")) || 2970 jQuery(this).attr('data-req')) { 2971 2972 var $this = jQuery(this); 2973 var dtype = $this.attr('dtype'); 2974 2975 if (dtype && dtype == 'range') { 2976 var range = $this.val().split('-'); 2977 if (!range[1]) { 2978 error = true; 2979 $this.val(''); 2980 } 2981 } 2982 if ($this.attr('date')) { 2983 2984 if (dtype == 'time') { 2985 var validTime = $this.val().match(/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/); 2986 if (!validTime) { 2987 error = true; 2988 $this.val(''); 2989 } 2990 } else if (dtype != 'range') { 2991 var date = new Date($this.val()); 2992 2993 if (!isDateValid(date)) { 2994 error = true; 2995 $this.val(''); 2996 2997 } 2998 } else { 2999 var date1 = new Date(range[0]); 3000 var date2 = new Date(range[1]); 3001 if (!isDateValid(date1) || !isDateValid(date2)) { 3002 error = true; 3003 $this.val(''); 3004 3005 } 3006 } 3007 } else if ($this.is(':checkbox') || $this.is(':radio')) { 3008 3009 if (!$this.is(':checked') && !jQuery('input[name="' + $this.attr('name') + '"]:checked').val()) { 3010 error = true; 3011 } 3012 } else { 3013 var value = $this.val(); 3014 if (value == null || value.length == 0 || (value == -1 && $this.is("select"))) { 3015 error = true; 3016 if ($this.is("select")) 3017 $this.next().addClass('dig_input_error'); 3018 3019 $this.trigger('focus'); 3020 } 3021 } 3022 3023 } 3024 3025 }); 3026 3027 if (error) { 3028 showDigNoticeMessage(dig_mdet.fillAllDetails); 3029 return false; 3030 } 3031 if (form.find(".dig_opt_mult_con_tac").find('.dig_input_error').length) { 3032 showDigErrorMessage(dig_mdet.accepttac); 3033 return false; 3034 } 3035 3036 return true; 3037 } 3038 3039 function hideDigitsLoader() { 3040 jQuery('body').addClass('dig_low_overlay'); 3041 loader.show(); 3042 hideDigMessage(); 3043 3044 } 3045 3046 function showDigitsLoader(hideLoader) { 3047 jQuery('body').removeClass('dig_low_overlay'); 3048 if (hideLoader) loader.hide(); 3049 3050 } 3051 3052 function isDateValid(date) { 3053 return date.getTime() === date.getTime(); 3054 } 3055 3056 function isJSON(data) { 3057 if (typeof data != 'string') 3058 data = JSON.stringify(data); 3059 3060 try { 3061 JSON.parse(data); 3062 return true; 3063 } catch (e) { 3064 return false; 3065 } 3066 } 3067 3068 function add_otp_class(status, field) { 3069 if (field == null) return; 3070 var container = field.parent().parent(); 3071 container.find('.otp_message').remove(); 3072 var read_only = false; 3073 3074 var otp_class; 3075 if (status == 10) { 3076 otp_class = 'checking_otp'; 3077 } else if (status == 1) { 3078 read_only = true; 3079 otp_class = 'valid_otp'; 3080 container.append('<div class="otp_message otp_valid_message">' + dig_mdet.codevalidproceedcheckout + '</div>'); 3081 } else if (status == -1) { 3082 otp_class = ''; 3083 } else { 3084 otp_class = 'invalid_otp'; 3085 } 3086 3087 field.attr('readonly', read_only);
3088 container.removeClass('valid_otp invalid_otp checking_otp').addClass(otp_class); 3089 3090 } 3091 3092 /*Remove Duplicate Fields*/ 3093 var dokan_if_seller = jQuery(".woocommerce-form-register .show_if_seller"); 3094 if (dokan_if_seller.length) { 3095 var wc_form = jQuery(".woocommerce-form-register"); 3096 if (wc_form.find('#dig_cs_name').length) { 3097 wc_form.find("#first-name").closest('.form-row').remove(); 3098 } 3099 if (wc_form.find('#dig_cs_lastname').length) { 3100 wc_form.find("#last-name").closest('.form-row').remove(); 3101 } 3102 if (dig_mdet.mobile_accept > 0) { 3103 wc_form.find("#shop-phone").closest('.form-row').remove(); 3104 } 3105 } 3106 3107 //next social 3108 setTimeout(function () { 3109 var form = jQuery('.digits_login_form').find('#nsl-custom-login-form-2'); 3110 if (form.length) { 3111 form.parent().append(form); 3112 } 3113 }, 500); 3114 3115 if (dig_mdet.secure_forms) { 3116 var wc_login_form = jQuery('.woocommerce-form-login'); 3117 if (wc_login_form.length) { 3118 wc_login_form.find('input[type="password"]').closest('.form-row').remove(); 3119 var wc_login_submit = wc_login_form.find('[type="submit"]'); 3120 var lost_password = wc_login_form.find('.lost_password'); 3121 var last_wc_submit = wc_login_submit.last().closest('.form-row'); 3122 lost_password.appendTo(last_wc_submit); 3123 var last_wc_submit_index = last_wc_submit.index() + 1 3124 if (last_wc_submit_index == 0) { 3125 last_wc_submit_index = 1; 3126 } 3127 wc_login_form.children().slice(0, last_wc_submit_index).wrapAll(secure_wrap); 3128 3129 wc_login_submit.remove(); 3130 } 3131 3132 var wp_login_form = jQuery(".wp_login"); 3133 if (wp_login_form.length) { 3134 wp_login_form.find('input[type="password"]').closest('.user-pass-wrap').remove();
3135 wp_login_form.wrapInner(secure_wrap); 3136 var wp_login_form_section = wp_login_form.find('.form_last_section'); 3137 wp_login_form.find('[type="submit"]').remove(); 3138 wp_login_form_section.appendTo(wp_login_form); 3139 } 3140 3141 var ihc_secure_login_form = jQuery("#ihc_login_form"); 3142 if (ihc_secure_login_form.length) { 3143 ihc_secure_login_form.addClass('digits_form_index_section'); 3144 ihc_secure_login_form.find('input[type="password"]').closest('.impu-form-line-fr').remove(); 3145 ihc_secure_login_form.find('input').first().nextUntil('.ihc-clear').next().andSelf().wrapAll(secure_wrap); 3146 var ihc_secure_login_form_submit = ihc_secure_login_form.find('.impu-form-submit'); 3147 ihc_secure_login_form_submit.empty(); 3148 ihc_secure_login_form_submit.append(jQuery('#digits_ihc_form_secure_login').html()); 3149 var ihc_secure_login_uname_wrap = ihc_secure_login_form.find('.digcon'); 3150 ihc_secure_login_uname_wrap.find('.countrycode').attr('name', 'digt_countrycode'); 3151 ihc_secure_login_uname_wrap.find('#iump_login_username').attr('id', 'user_login'); 3152 var ihc_captcha = ihc_secure_login_form.find('.digits_captcha_row').first(); 3153 ihc_captcha.insertBefore(ihc_secure_login_form.find('.impu-remember-wrapper')); 3154 } 3155 3156 jQuery(document).on('click', '.digits_secure_login-tp', function (e) { 3157 e.preventDefault(); 3158 var $this = jQuery(this); 3159 var form = $this.closest('form'); 3160 form.removeAttr('action'); 3161 var username = form.find('#username'); 3162 if (!username.length) { 3163 username = form.find('#user_login'); 3164 } 3165 update_login_action_type(form, username); 3166 window.digitsSecureFormSubmit(form); 3167 return false; 3168 }) 3169 3170 function update_login_action_type(form, login_user_inp) { 3171 var login_type = 'email'; 3172 var update_login_field = 'digits_email'; 3173 var login_user = login_user_inp.val(); 3174 if (is_mobile(login_user)) { 3175 login_type = 'phone'; 3176 update_login_field = 'digits_phone'; 3177 } 3178 form.addClass('digits-tp_style'); 3179 form.find('[name="action_type"]').val(login_type); 3180 form.find('[name="' + update_login_field + '"]').val(login_user); 3181 } 3182 3183 jQuery(window).trigger('digits_auto_login'); 3184 } 3185 3186}); 3187 3188function verifyOTPbilling(sen) { 3189 if (sen === 10) { 3190 jQuery(document).trigger('digits_process_wc_checkout'); 3191 return; 3192 } 3193 var l; 3194 if (sen == 2) { 3195 l = document.getElementById('dig_billing_signupwithpassword'); 3196 } else { 3197 l = document.getElementById('dig_billing_validate_button'); 3198 } 3199 l.click(); 3200 3201} 3202jQuery(function() { 3203 jQuery(document).ready(function(){ 3204 jQuery("#username,#dig-mobmail,.countrycode,#digits_reg_name,#digits_reg_username,#digits_reg_email,#reg_email,.dig-secondmailormobile,#forgotpass,#user_login,#secondmailormobile,.license_key,.mobile,.dig_wc_nw_phone,.mobile_field,input[type='tel']").on("keyup change",function(e){ 3205 jQuery(this).val(convert_number.toNormal(jQuery(this).val())); 3206 }); 3207 }); 3208}); 3209} 3210
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.