' +
'')
.insertBefore("#ihc_login_form .impu-form-submit");
jQuery('.dig_ihc_logincountrycode').on("keyup change focusin", function (e) {
var size = jQuery(this).val().length;
size++;
if (size < 2) size = 2;
jQuery(this).attr('size', size);
var code = jQuery(this).val();
if (code.trim().length == 0) {
jQuery(this).val("+");
}
usernameihc.attr('style', "padding-left:" + mobilePaddingLeft((jQuery(".dig_ihc_logincountrycode").outerWidth(true) + 10) + "px !important"));
});
jQuery('#ihc_login_form').off('submit');
var remotp = 0;
jQuery(document).on("click", "#impu_log_submit", function () {
update_time_button = jQuery(this);
cuForm = jQuery(this).closest('form');
if (verifyimpuotp == 1) {
verifyOtp(jQuery(".dig_ihc_logincountrycode").val(), usernameihc.val(), dig_mdet.nonce, jQuery("#digits_otp_ihc").val(), 1);
return false;
}
if (isNumeric(usernameihc.val())) {
ihc_loginform = 1;
akCallback = 'loginCallback';
verifyMobileNoLogin(jQuery(".dig_ihc_logincountrycode").val(), usernameihc.val(), dig_mdet.nonce, 1);
if (remotp == 0) {
remotp = 1;
ihcloginform.find("#digorimp").hide();
ihcloginform.find('.impu-form-submit').find("input:first").remove();
ihcloginform.find("div").each(function (index) {
if (index > 1) {
if (!jQuery(this).hasClass("impu-form-submit") && !jQuery(this).hasClass("dig_ihc_logincountrycodecontainer") && !jQuery(this).hasClass("impu-dig-otp"))
jQuery(this).hide();
}
});
}
}
return false;
});
if (dig_mdet.login_otp_accept > 0) {
ihcloginform.find(".impu-form-submit").append("
" + dig_mdet.or + "
" +
"" +
"
" + dig_mdet.resendOTP + " (00:30)
");
}
}
var verifyimpuotp = 0;
var ihc_loginform = 0;
var ihcforgotpasswrap = jQuery(".ihc-pass-form-wrap");
var ihforgaction = ihcforgotpasswrap.find("input[type='hidden']");
var forgotpassMobVerifiedihc = 0;
var forgotpassihc = 0;
if (ihforgaction.val() == "reset_pass" && dig_mdet.forgot_pass > 0) {
var ihcforgpassform = ihcforgotpasswrap.find("form");
var ihcforgsub = ihcforgpassform.find("input[type='submit']");
jQuery("
" + dig_mdet.resendOTP + " (00:30)
")
.insertAfter(ihcforgsub);
ihcforgpassform.append("");
var ihcForgotUsername = ihcforgotpasswrap.find("input[type='text']");
ihcforgpassform.on('submit', function (e) {
update_time_button = jQuery(this);
if (forgotpassihc == 2) {
var pass = jQuery("#digits_password_ihc").val();
var cpass = jQuery("#digits_cpassword_ihc").val();
if (pass != cpass) {
showDigErrorMessage(dig_mdet.Passwordsdonotmatch);
return false;
}
ihcforgpassform.off('submit').submit();
return;
}
forgotpassihc = 1;
if (isNumeric(ihcForgotUsername.val())) {
ihcforgpassform.attr("action", acur + "?login=true");
ihcForgotUsername.attr("name", "forgotmail");
var countrycode = jQuery(".dig_ihc_forgotcountrycode").val();
akCallback = 'forgotihcCallback';
if (forgotpassMobVerifiedihc == 0) {
verifyMobileNoLogin(countrycode, ihcForgotUsername.val(), dig_mdet.nonce, 3);
} else {
forgotpassihc = 1;
verifyOtp(countrycode, ihcForgotUsername.val(), dig_mdet.nonce, jQuery("#digits_otp_forg_ihc").val(), 3)
}
return false;
}
ihcForgotUsername.attr("name", "email_or_userlogin");
ihcforgpassform.removeAttr("action");
return true;
});
var ccd = dig_mdet.uccode;
ihcForgotUsername.wrap('').before('
' +
'
');
ihcForgotUsername.attr("placeholder", dig_mdet.UsernameMobileno);
jQuery(
'' +
'')
.insertAfter(ihcForgotUsername.closest(".impu-form-line-fr"));
jQuery('')
.insertAfter(ihcForgotUsername.closest(".impu-form-line-fr"));
jQuery('')
.insertAfter(ihcForgotUsername.closest(".impu-form-line-fr"));
ihcForgotUsername.on("keyup change focusin", function (e) {
if (isNumeric(jQuery(this).val())) {
jQuery(".dig_ihc_forgot_countrycodecontainer").css({"display": "inline-block"});
jQuery(this).attr('style', "padding-left:" + mobilePaddingLeft((jQuery(".dig_ihc_forgotcountrycode").outerWidth(true) + 10) + "px !important"));
} else {
jQuery(".dig_ihc_forgot_countrycodecontainer").hide();
jQuery(this).removeAttr('style');
}
});
jQuery('.dig_ihc_forgotcountrycode').on("keyup change focusin", function (e) {
var size = jQuery(this).val().length;
size++;
if (size < 2) size = 2;
jQuery(this).attr('size', size);
var code = jQuery(this).val();
if (code.trim().length == 0) {
jQuery(this).val("+");
}
ihcForgotUsername.attr('style', "padding-left:" + mobilePaddingLeft((jQuery(".dig_ihc_forgotcountrycode").outerWidth(true) + 10) + "px !important"));
});
}
function mobilePaddingLeft(value) {
if (dig_mdet.dig_hide_ccode == 1) {
return '0.75em';
} else {
return value;
}
}
if (jQuery(".dig_bp_enb").length) {
jQuery(".dig_bp_enb").each(function (index) {
jQuery(this).remove();
});
}
var dig_bp_btn = 0;
var verfiyBPReg = 0;
jQuery(document).on("click", "#signup_submit_pass_bp", function () {
if (verfiyBPReg == 1) return true;
verfiyBPReg = 1;
var bpForm = jQuery("#buddypress").find("form");
bpForm.find("#dig_reg_bp_pass").show().find("input").attr("required", "required");
bpForm.find("#signup_submit_otp_bp").hide();
return false;
});
jQuery("#buddypress #signup-form").on('submit', function () {
update_time_button = jQuery(this).find('input[name="signup_submit"]');
if (dig_bp_btn == 2) return true;
dig_bp_btn = 1;
var bpForm = jQuery(this);
tokenCon = bpForm;
var phone = bpForm.find("#username").val();
var countrycode = bpForm.find(".dig_wc_logincountrycode").val();
var otp = jQuery("#dig_bp_reg_otp");
var pass = bpForm.find("#signup_password").val();
if (dig_mdet.strong_pass == 1) {
if (dig_mdet.pass_accept == 2 || pass.length > 0) {
var strength = wp.passwordStrength.meter(pass, ['black', 'listed', 'word'], pass);
if (strength != null && strength < 3) {
showDigNoticeMessage(dig_mdet.useStrongPasswordString);
return false;
}
}
}
if (verifybpotp == 1) {
verifyOtp(countrycode, phone, nounce.val(), otp.find("input").val(), 2);
} else if (phone.length == 0) {
showDigNoticeMessage(dig_mdet.pleaseentermobormail);
} else if (pass.length == 0 && !isNumeric(phone)) {
showDigNoticeMessage(dig_mdet.eitherentermoborusepass);
} else if (isNumeric(phone)) {
if (bpForm.find("#signup_submit_otp_bp").is(':visible')) bpForm.find("#signup_submit_pass_bp").remove();
akCallback = 'updateRegisterDetails';
verifyMobileNoLogin(countrycode, phone, nounce.val(), 2);
} else if (validateEmail(phone)) {
return true;
} else {
showDigErrorMessage(dig_mdet.Invaliddetails);
}
return false;
});
var verifybpotp = 0;
function updateRegisterDetails(response) {
showDigitsLoader(true);
if (response.status === "PARTIALLY_AUTHENTICATED") {
var code = response.code;
var csrf = response.state;
jQuery("#dig_bp_reg_code").val(code);
jQuery("#dig_bp_reg_csrf").val(csrf);
dig_bp_btn = 2;
jQuery("#buddypress").find("form").submit();
}
}
var bpuseredit = 0;
var bpeditverify = 0;
jQuery("#buddypress").find("form#settings-form").on('submit', function () {
update_time_button = jQuery(this).find('[type="submit"]');
var form = jQuery(this);
tokenCon = form;
var uname = form.find("#username").val();
var ccode = form.find(".dig_wc_logincountrycode").val();
if (jQuery("#dig_superadmin").length) return true;
if (isNumeric(uname)) {
if (uname == form.find("#dig_bp_current_mob")) return true;
if (bpeditverify == 1) {
var otp = jQuery("#bp_otp_dig_ea");
verifyOtp(ccode, uname, nounce.val(), otp.find("input").val(), 11);
} else {
bpuseredit = 1;
akCallback = 'updateBPAccountDetails';
verifyMobileNoLogin(ccode, uname, nounce.val(), 11);
}
} else return true;
return false;
});
function updateBPAccountDetails(response) {
showDigitsLoader(true);
if (response.status === "PARTIALLY_AUTHENTICATED") {
var code = response.code;
var csrf = response.state;
jQuery("#dig_bp_ea_code").val(code);
jQuery("#dig_bp_ea_csrf").val(csrf);
dig_bp_btn = 2;
jQuery("#buddypress").find("form").off("submit").submit();
}
}
if (dig_mdet.login_mobile_accept !== 0) {
var bb_wp_lform = jQuery(".wp_login");
if (dig_mdet.login_mail_accept == 0 && dig_mdet.login_uname_accept == 0) {
bb_wp_lform.find('#username').data('type', 2);
}
if (!bb_wp_lform.length) {
bb_wp_lform = jQuery(".wp-core-ui #loginform");
bb_wp_lform.addClass('wp_login');
}
if (bb_wp_lform.length && dig_mdet.login_otp_accept > 0) {
bb_wp_lform.addClass('digits');
bb_wp_lform.find("[type='submit']").parent().append("
" + dig_mdet.or + "
" +
"" +
"
" + dig_mdet.resendOTP + " (00:30)
");
}
}
jQuery(".wp_reg").on('submit', function () {
if (registerstatus == 1) return true;
update_time_button = jQuery(this).find("[type='submit']");
curRegForm = jQuery(this);
tokenCon = curRegForm;
var mobile = formatMobileNumber(curRegForm.find("#username").val());
var ccode = curRegForm.find(".dig_wc_logincountrycode").val();
var custom_validation = validateCustomFields(curRegForm);
if (!custom_validation) {
return false;
}
if (dig_mdet.mobile_accept == 0) {
return true;
}
if (!isNumeric(mobile) || !isNumeric(ccode) || ccode.length == 0 || mobile.length == 0) {
if (mobile.length == 0 && dig_mdet.mobile_accept == 1) {
return true;
}
showDigErrorMessage(dig_mdet.InvalidMobileNumber);
return false;
}
var otp = jQuery("#reg_billing_otp");
if (regverify == 1) {
verifyOtp(ccode, mobile, nounce.val(), otp.val(), 2);
return false;
}
if (curRegForm.find("#user_uname").length) {
username_reg_field = curRegForm.find("#user_uname").val();
}
if (curRegForm.find(".dig-custom-field-type-captcha").length) {
captcha_reg_field = curRegForm.find(".dig-custom-field-type-captcha").find("input[type='text']").val();
captcha_ses_reg_field = curRegForm.find(".dig-custom-field-type-captcha").find(".dig_captcha_ses").val();
}
email_reg_field = curRegForm.find("#user_email").val();
akCallback = 'registerWooCallBack';
verifyMobileNoLogin(ccode, mobile, nounce.val(), 2);
return false;
});
function updateIHCAccountDetails(response) {
showDigitsLoader(true);
if (response.status === "PARTIALLY_AUTHENTICATED") {
var code = response.code;
var csrf = response.state;
jQuery("#dig_ihc_ea_code").val(code);
jQuery("#dig_ihc_ea_csrf").val(csrf);
submiticform = 1;
jQuery(".ihc-form-create-edit").submit();
}
}
var submiticform = 0;
var ihcedform = 0;
if (c.length) {
var e = jQuery("#dig_ihc_mobcon");
if (jQuery(".iump-register-form").find("#edituser").length && dig_mdet.mobile_accept > 0) {
jQuery(c).prepend(e);
jQuery(e.find("#dig_ihc_mobotp")).insertBefore(c.find("input[type='submit']").closest('.iump-submit-form'));
}
jQuery(".ihc-form-create-edit input[type=submit]").on('click', function () {
update_time_button = jQuery(this);
var form = jQuery(".ihc-form-create-edit");
if (submiticform == 1 || !form.find("#username").length) return true;
var mob = form.find("#username").val();
var ccode = form.find(".dig_wc_logincountrycode").val();
if (mob == form.find("#dig_ihc_current_mob").val()) return true;
if (isNumeric(mob)) {
if (ihcedform == 2) {
var otp = form.find("#dig_ihc_mobotp");
verifyOtp(ccode, mob, nounce.val(), otp.find("input").val(), 11);
} else {
akCallback = 'updateIHCAccountDetails';
ihcedform = 1;
verifyMobileNoLogin(ccode, mob, nounce.val(), 11);
}
} else if (mob.length > 0) {
showDigErrorMessage(dig_mdet.InvalidMobileNumber);
} else return true;
return false;
})
}
var submitumform = 0;
var subitumotp = 0;
um_register.find("form").on('submit', function () {
update_time_button = jQuery(this).find('#um-submit-btn');
if (submitumform == 1) return true;
var form = jQuery(this);
var uid = form.find("#username").val();
var ccode = form.find(".dig_wc_logincountrycode").val();
var c = form.find(".dig_otp_um_reg");
if (!uid) return true;
if (form.find("#um_sub").length > 0) {
return true;
}
var custom_validation = validateCustomFields(form);
if (!custom_validation) {
return false;
}
if (!isNumeric(uid)) {
showDigErrorMessage(dig_mdet.InvalidMobileNumber);
return false;
}
loader.show();
uid = formatMobileNumber(uid);
akCallback = 'submitUMRegform';
if (subitumotp == 2) {
verifyOtp(ccode, uid, nounce.val(), c.find("input").val(), 2);
} else {
subitumotp = 1;
verifyMobileNoLogin(ccode, uid, nounce.val(), 2);
}
jQuery(".um-register").find("input[type='submit']").removeAttr('disabled');
return false;
});
jQuery(".dig_um_loginviaotp").on('click', function () {
update_time_button = jQuery(this);
var phoneNumber = um_login.find("#username").val();
var csrf = jQuery(".dig_nounce").val();
var countryCode = um_login.find(".dig_wc_logincountrycode").val();
if (phoneNumber == "" || countryCode == "") {
showDigErrorMessage(dig_mdet.InvalidMobileNumber);
return false;
}
var otpin = jQuery(".dig_otp_um_login");
if (!isNumeric(phoneNumber) || !isNumeric(phoneNumber)) {
showDigErrorMessage(dig_mdet.InvalidMobileNumber);
return false;
}
if (subitumotp == 2) {
verifyOtp(countryCode, phoneNumber, csrf, otpin.find("input").val(), 1);
return false;
}
if (isNumeric(phoneNumber)) {
akCallback = 'loginCallback';
subitumotp = 1;
verifyMobileNoLogin(countryCode, phoneNumber, csrf, 1);
} else if (phoneNumber.length > 0) {
showDigNoticeMessage(dig_log_obj.Thisfeaturesonlyworkswithmobilenumber);
} else {
akCallback = 'loginCallback';
verifyMobileNoLogin(countryCode, phoneNumber, csrf);
}
return false;
});
function submitUMRegform(response) {
showDigitsLoader(true);
if (response.status === "PARTIALLY_AUTHENTICATED") {
var code = response.code;
var csrf = response.state;
jQuery("#digits_um_code").val(code);
jQuery("#digits_um_csrf").val(csrf);
submitumform = 1;
jQuery(".um-register").find("form").submit();
}
}
if (jQuery("#dig_reg_mail").length > 0) {
if (jQuery("#reg_email").attr('placeholder') != '' && jQuery("#reg_email").attr('placeholder') != null) {
var fn_pld = jQuery("#reg_billing_first_name");
fn_pld.attr('placeholder', jQuery.trim(fn_pld.parent().find('label').text()));
register.find('.dig-custom-field').each(function () {
var lb = jQuery.trim(jQuery(this).find('label').text());
if (lb) jQuery(this).find('input').attr('placeholder', lb);
});
}
}
function formatMobileNumber(number) {
return number.replace(/^0+/, '');
}
function validateCustomFields(form) {
var error = false;
if (form.attr('wait')) {
showDigNoticeMessage(form.attr('wait'));
return false;
}
if (form.attr('error')) {
showDigErrorMessage(form.attr('error'));
return false;
}
form.find('input,textarea,select').each(function () {
if ((jQuery(this).attr('required') && jQuery(this).is(":visible")) ||
jQuery(this).attr('data-req')) {
var $this = jQuery(this);
var dtype = $this.attr('dtype');
if (dtype && dtype == 'range') {
var range = $this.val().split('-');
if (!range[1]) {
error = true;
$this.val('');
}
}
if ($this.attr('date')) {
if (dtype == 'time') {
var validTime = $this.val().match(/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/);
if (!validTime) {
error = true;
$this.val('');
}
} else if (dtype != 'range') {
var date = new Date($this.val());
if (!isDateValid(date)) {
error = true;
$this.val('');
}
} else {
var date1 = new Date(range[0]);
var date2 = new Date(range[1]);
if (!isDateValid(date1) || !isDateValid(date2)) {
error = true;
$this.val('');
}
}
} else if ($this.is(':checkbox') || $this.is(':radio')) {
if (!$this.is(':checked') && !jQuery('input[name="' + $this.attr('name') + '"]:checked').val()) {
error = true;
}
} else {
var value = $this.val();
if (value == null || value.length == 0 || (value == -1 && $this.is("select"))) {
error = true;
if ($this.is("select"))
$this.next().addClass('dig_input_error');
$this.trigger('focus');
}
}
}
});
if (error) {
showDigNoticeMessage(dig_mdet.fillAllDetails);
return false;
}
if (form.find(".dig_opt_mult_con_tac").find('.dig_input_error').length) {
showDigErrorMessage(dig_mdet.accepttac);
return false;
}
return true;
}
function hideDigitsLoader() {
jQuery('body').addClass('dig_low_overlay');
loader.show();
hideDigMessage();
}
function showDigitsLoader(hideLoader) {
jQuery('body').removeClass('dig_low_overlay');
if (hideLoader) loader.hide();
}
function isDateValid(date) {
return date.getTime() === date.getTime();
}
function isJSON(data) {
if (typeof data != 'string')
data = JSON.stringify(data);
try {
JSON.parse(data);
return true;
} catch (e) {
return false;
}
}
function add_otp_class(status, field) {
if (field == null) return;
var container = field.parent().parent();
container.find('.otp_message').remove();
var read_only = false;
var otp_class;
if (status == 10) {
otp_class = 'checking_otp';
} else if (status == 1) {
read_only = true;
otp_class = 'valid_otp';
container.append('
' + dig_mdet.codevalidproceedcheckout + '
');
} else if (status == -1) {
otp_class = '';
} else {
otp_class = 'invalid_otp';
}
field.attr('readonly', read_only);
container.removeClass('valid_otp invalid_otp checking_otp').addClass(otp_class);
}
/*Remove Duplicate Fields*/
var dokan_if_seller = jQuery(".woocommerce-form-register .show_if_seller");
if (dokan_if_seller.length) {
var wc_form = jQuery(".woocommerce-form-register");
if (wc_form.find('#dig_cs_name').length) {
wc_form.find("#first-name").closest('.form-row').remove();
}
if (wc_form.find('#dig_cs_lastname').length) {
wc_form.find("#last-name").closest('.form-row').remove();
}
if (dig_mdet.mobile_accept > 0) {
wc_form.find("#shop-phone").closest('.form-row').remove();
}
}
});
function verifyOTPbilling(sen) {
var l;
if (sen == 2) {
l = document.getElementById('dig_billing_signupwithpassword');
} else {
l = document.getElementById('dig_billing_validate_button');
}
l.click();
}