Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: subadmin.js
$(document).ready(function() { function validate() { var errors = ''; if ($("#txtEmail").val()=='') errors += "- Please enter Username<br />"; /*if ($("#roleId").val() == '0') errors += "- Please Select Admin Role<br />";*/ if ($("#id").val() == 0) { if ($("#txtPass").val()=='') errors += "- Please enter Password<br>"; if ($("#txtPass").val().length < 8) errors += "- Password should be atleast of 8 characters<br>"; if ($("#txtCPass").val()=='') errors += "- Please enter Confirm Password<br>"; if ($("#txtPass").val() != $("#txtCPass").val()) errors += "- Passwords do not match<br>"; } else { if ($("#txtPass").val()!='') { if ($("#txtPass").val().length < 8) errors += "- Password should be atleast of 8 characters<br>"; if ($("#txtCPass").val()=='') errors += "- Please enter Confirm Password<br>"; if ($("#txtPass").val() != $("#txtCPass").val()) errors += "- Passwords do not match<br>"; } } if ($("#txtFName").val()=='') errors += "- Please enter First Name<br />"; if ($("#txtLName").val()=='') errors += "- Please enter Last Name<br />"; if ($("#txtPhone").val()=='') errors += "- Please enter Phone<br />"; if ($("#txtEmail2").val()=='') errors += "- Please enter Email<br />"; if (errors=='') return true; else { showStickyErrorToast(errors, 'Errors', 'error'); return false; } } /*$("#chkGAuth").click(function(){ if(document.getElementById('chkGAuth').checked) { $('#imgGAuth').show(); } else $('#imgGAuth').hide(); });*/ $("#btnSave").click(function(){ if(validate()) { $('#statusLoader').ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); var chkBxVal = chkGAuth = 0; if(document.getElementById('chkDisable').checked) chkBxVal = 1; if(document.getElementById('chkLoginVerification_QR').checked) chkGAuth = 1; if(document.getElementById('chkLoginVerification_OTP').checked) chkGAuth = 0; if(document.getElementById('chkLoginVerification_off').checked) chkGAuth = 3; var depts = []; $.each($("input[name='deptId']:checked"), function(){ depts.push($(this).val()); }); $.post(base_url+apanel_name+"/system/ajxsubadmin", { email:$('#txtEmail').val(), fName:$('#txtFName').val(), lName:$('#txtLName').val(), pass:$('#txtPass').val(), phone:$('#txtPhone').val(), roleId:$('#roleId').val(), email2:$('#txtEmail2').val(), invalid:$('#invalid').val(), chkBxVal:chkBxVal, chkGAuth:chkGAuth, depts:depts.join(","), gAuthSecret:$('#gAuthSecret').val(), purpose:'save', id:$('#id').val() }, function(response){ if(response) { console.log(response); arrResponse = response.msg.split('~'); if(arrResponse[1] == 1) { $('#txtEmail').val(''); $('#txtFName').val(''); $('#txtLName').val(''); $('#txtPhone').val(''); $('#txtEmail2').val(''); $('.imgGoogleAuth').attr('src', response.qr_image); document.getElementById('chkDisable').checked = false; } else { $('.imgGoogleAuth').attr('src', response.qr_image); showStickyErrorToast(arrResponse[0], '', 'success'); if(response.is_disable != 3){ alert( "ACTION NEEDED -- NOT DEACTIVATED YET\n" + "• Please check your email to verify deactivation of google authentication" ); } } } }, 'json'); } }); //------------toogle buttons --------------- $('#chkLoginVerification_QR').on('click', function() { document.getElementById("chkLoginVerification_OTP").checked = false; document.getElementById("chkLoginVerification_off").checked = false; }); $('#chkLoginVerification_OTP').on('click', function() { document.getElementById("chkLoginVerification_QR").checked = false; document.getElementById("chkLoginVerification_off").checked = false; $('#imgGAuth').hide(); $('#imgGAuthForm').hide(); }); $('#chkLoginVerification_off').on('click', function() { document.getElementById("chkLoginVerification_OTP").checked = false; document.getElementById("chkLoginVerification_QR").checked = false; $('#imgGAuth').hide(); $('#imgGAuthForm').hide(); }); $('[name="chkGAuth"]').click(function() { $(this).prop('checked', true).siblings(':checkbox').prop("checked", false); }); $('.qrCodeFromSubmit').click(function() { var qrValue = document.getElementById("qrCodeFormCode").value; var id = document.getElementById("id").value; $.ajax({ type: "POST", url: base_url+apanel_name+"/system/checkQR", dataType: "json", data: {'qrValue':qrValue, 'id':id}, success: function(result) { if(result.status == 1){ $('#imgGAuth').show(300); $('#imgGAuthForm').hide(300); $('#imgGAuthForm').removeClass('invalid'); $('[name="invalid"]').attr('disabled', true); $('.GoogleAuthImg').attr('src', result.msg); alert(result.message); }else{ $('.GoogleAuthFormImg').attr('src', result.msg); $('#imgGAuth').hide(300); $('#imgGAuthForm').show(300); alert(result.message); } } }); }); $('.chkLoginVerification').on('click', function() { if ($(this).is(":checked") && $(this).prop('checked', true).siblings(':checkbox').prop("checked", true)) { document.getElementById("chkLoginVerification_OTP").checked = false; document.getElementById("chkLoginVerification_off").checked = false; var id = document.getElementById("id").value; $.ajax({ type: "POST", url: base_url+apanel_name+"/system/getQR", data: {'id':id}, dataType: "json", success: function(result) { if(result.msg == 0){ $('#imgGAuth').show(300); $('#imgGAuthForm').hide(300); }else{ $('#imgGAuth').hide(300); $('#imgGAuthForm').show(300); $('.GoogleAuthFormImg').attr('src', result.msg); } } }); } }); //------------------------------------------ });