// app.getCookie("azer_token", function (e, r) { // if (e) { // app.redirectUrl(`../dashio/home?azer_token=${r}`); // } // }); //====================SIGN UP VERIFICATION============= const signup = document.querySelector(".signup-form"); const signupBtn = document.getElementById("signUpBtn"); // const signupEmail = document.querySelector(".sign-email"); const companyName = document.getElementById("companyName"); const firstName = document.getElementById("firstName"); const lastName = document.getElementById("lastName"); const email = document.getElementById("email"); const password = document.getElementById("password"); const companyWebsite = document.getElementById("companyWebsite"); const soultionLookingFor = document.getElementById("soultionLookingFor"); const solutionOffered = document.getElementById("solutionOffered"); // const checkbox = document.getElementById("checkbox"); let emailStatus = false; let passCount = 0; /* Checking password strength */ $(document).ready(function () { //you have to use keyup, because keydown will not catch the currently entered value $("input[type=password]") .on("keyup touchend", function () { // set password variable var pswd = $(this).val(); //validate the length if (pswd.length < 8) { $("#length").removeClass("valid").addClass("invalid"); passCount++; } else { $("#length").removeClass("invalid").addClass("valid"); passCount = 0; } //validate uppercase letter if (pswd.match(/[A-Z]/)) { $("#capital").removeClass("invalid").addClass("valid"); passCount++; } else { $("#capital").removeClass("valid").addClass("invalid"); passCount = 0; } //validate number if (pswd.match(/\d/)) { $("#number").removeClass("invalid").addClass("valid"); passCount++; } else { $("#number").removeClass("valid").addClass("invalid"); passCount = 0; } }) .focus(function () { $("#pswd_info").show(); document.querySelector(".pass-err").classList.remove("active"); }) .blur(function () { $("#pswd_info").hide(); }); }); /* =====Password show====== */ const signupPassCheck = document.getElementById("pass-check"); signupPassCheck.addEventListener("click", () => { if (signupPassCheck.checked) { password.type = "text"; } else { password.type = "password"; } }); /* =====Validating form with btn====== */ const myContStyle = document.querySelector(".myCont-style"); const containerFluid = document.querySelector(".card"); const userType = "partner"; signupBtn.addEventListener("click", (e) => { e.preventDefault(); /* Checking for a valid mail */ function ValidateEmail(input) { var validRegex = /^[^ ]+@[^ ]+\.[a-z]{2,3}$/; if (input.value.match(validRegex)) { emailStatus = true; email.focus(); return true; } else { emailStatus = false; document.querySelector(".email-err").classList.add("active"); setTimeout(() => { document.querySelector(".email-err").classList.remove("active"); }, 2000); email.focus(); return false; } } if (!companyName.value) { document.querySelector(".compNam-err").classList.add("active"); setTimeout(() => { document.querySelector(".compNam-err").classList.remove("active"); }, 2000); } if (!firstName.value) { document.querySelector(".firstName-err").classList.add("active"); setTimeout(() => { document.querySelector(".firstName-err").classList.remove("active"); }, 2000); } if (!lastName.value) { document.querySelector(".lastName-err").classList.add("active"); setTimeout(() => { document.querySelector(".lastName-err").classList.remove("active"); }, 2000); } if (!companyWebsite.value) { document.querySelector(".compWeb-err").classList.add("active"); setTimeout(() => { document.querySelector(".compWeb-err").classList.remove("active"); }, 2000); } if (soultionLookingFor.value == "") { document.querySelector(".solution-err").classList.add("active"); setTimeout(() => { document.querySelector(".solution-err").classList.remove("active"); }, 2000); } if (solutionOffered.value == "") { document.querySelector(".what-err").classList.add("active"); setTimeout(() => { document.querySelector(".what-err").classList.remove("active"); }, 2000); } if ( ValidateEmail(email) && companyName.value && firstName.value && lastName.value && companyWebsite.value && soultionLookingFor.value && solutionOffered.value && companyWebsite.value && passCount == 2 ) { myContStyle.classList.add("active"); // resetInputs(); } else if (passCount < 2) { document.querySelector(".pass-err").classList.add("active"); setTimeout(() => { document.querySelector(".pass-err").classList.remove("active"); }, 2000); } function resetInputs() { companyName.value = ""; firstName.value = ""; lastName.value = ""; companyWebsite.value = ""; soultionLookingFor.value = ""; solutionOffered.value = ""; email.value = ""; password.value = ""; } console.log(app.query("#password").value); function forms() { let formdata = { userType, companyName: app.query("#companyName").value, firstName: app.query("#firstName").value, lastName: app.query("#lastName").value, partnerWebsite: app.query("#companyWebsite").value, offeredSolution: app.query("#solutionOffered").value, solutionType: app.query("#soultionLookingFor").value, email: app.query("#email").value, password: app.query("#password").value, }; console.log(formdata); return formdata; } console.log(forms()); /* * CreateAccount init */ // console.log('%c Welcome to ' + '%c Coinazer.com', 'color: red; font-size: 30px;', 'color: rgb(0, 153, 255); font-size:30px;'); var captcha = sliderCaptcha({ id: "captcha", setSrc: function () { return "../public/images/Pic" + Math.round(Math.random() * 14) + ".jpg"; }, // captcha.reset(); onSuccess: function () { swal({ title: "Loading", html: "Please wait...", // type: 'success', padding: "2em", onOpen: function () { swal.showLoading(); }, }); var handler = setTimeout(function () { window.clearTimeout(handler); app.client .fetch("../client_access", "POST", forms()) .then(function (d) { console.log(d); if (!d.isSuccess) { sweetAlertE(d.icon, d.message, d.title); captcha.reset(); } else { sweetAlertS(d.icon, d.message, d.title, d.redirectUrl); captcha.reset(); } captcha.reset(); }); }, 500); }, }); }); function resetInputs() { companyName.value = ""; firstName.value = ""; lastName.value = ""; companyWebsite.value = ""; soultionLookingFor.value = ""; solutionOffered.value = ""; email.value = ""; password.value = ""; } /* * CreateAccount init */ // console.log('%c Welcome to ' + '%c Coinazer.com', 'color: red; font-size: 30px;', 'color: rgb(0, 153, 255); font-size:30px;'); var captcha = sliderCaptcha({ id: "captcha", setSrc: function () { return "../public/images/Pic" + Math.round(Math.random() * 14) + ".jpg"; }, // captcha.reset(); onSuccess: function () { swal({ title: "Loading", html: "Please wait...", // type: 'success', padding: "2em", onOpen: function () { swal.showLoading(); }, }); var handler = setTimeout(function () { window.clearTimeout(handler); function forms() { let formdata = { userType: "partner", companyName: app.query("#companyName").value, firstName: app.query("#firstName").value, lastName: app.query("#lastName").value, partnerWebsite: app.query("#companyWebsite").value, offeredSolution: app.query("#solutionOffered").value, solutionType: app.query("#soultionLookingFor").value, email: app.query("#email").value, password: app.query("#password").value, }; return formdata; } app.client.fetch("../client_access", "POST", forms()).then(function (d) { if (!d.isSuccess) { sweetAlertE(d.icon, d.message, d.title); captcha.reset(); } else { sweetAlertS(d.icon, d.message, d.title, d.redirectUrl); captcha.reset(); } captcha.reset(); }); }, 500); }, }); function forms() { let formdata = { userType: "partner", companyName: app.query("#companyName").value, firstName: app.query("#firstName").value, lastName: app.query("#lastName").value, partnerWebsite: app.query("#companyWebsite").value, offeredSolution: app.query("#solutionOffered").value, solutionType: app.query("#soultionLookingFor").value, email: app.query("#email").value, password: app.query("#password").value, }; return formdata; } function sweetAlertE(icon, msg, title) { swal({ title: title, html: msg, type: icon, timer: 3500, padding: "2em", onOpen: function () { swal.showLoading(); }, }).then(function (result) { if (result.dismiss === swal.DismissReason.timer) { myContStyle.classList.remove("active"); captcha.reset(); } }); } function sweetAlertS(icon, msg, title, url) { swal({ title: title, html: msg, type: icon, timer: 3500, padding: "2em", onOpen: function () { swal.showLoading(); }, }).then(function (result) { if (result.dismiss === swal.DismissReason.timer) { myContStyle.classList.remove("active"); captcha.reset(); window.location = url; } }); } myContStyle.addEventListener("click", (e) => { var isClickInsideElement = containerFluid.contains(e.target); if (!isClickInsideElement) { myContStyle.classList.remove("active"); } });