//========== START: account ========= var ZEL_account_email_res = 0; var ZEL_account_email_check_mct = 0; var ZEL_account_email_check_working = 0; function ZEL_account_email_check() { var d = new Date(); var mct = d.getTime(); var email = $('#ZEL_account_email').val(); var IDuser = $('#ZEL_account_IDuser').val(); IDuser=parseInt(IDuser); if (isNaN(IDuser)) { IDuser = 0; } if (email == "") { $('#ZEL_account_email_wait_cont').hide(); $('#ZEL_account_email_resp_cont').hide(); $('#ZEL_account_email_resp_cont').html(""); ZEL_account_email_res = 0; } else if (Zcheck_mail_format(email)) { ZEL_account_email_check_mct = mct; ZEL_account_email_check_working = 1; $('#ZEL_account_email_wait_cont').css("display", "flex"); $('#ZEL_account_email_resp_cont').hide(); var url = Zset["http"]+'ajax/account-email-check.php'; var params = 'email='+Zclean_ajax_param(email)+'&IDuser='+Zclean_ajax_param(IDuser)+'&mct='+mct+'&rand='+Math.random(); url=url+'?'+params; $.ajax(url, { type: "GET" }).done(function (response) { mct = ZEL_account_email_check_mct; var responsex = response.split(""); if (mct==responsex[1]) { if (responsex[0]=="1" || responsex[0]=="2") { ZEL_account_email_res = 1; $('#ZEL_account_email_resp_cont').html("email OK"); } else if (responsex[0]=="3") { ZEL_account_email_res = 2; $('#ZEL_account_email_resp_cont').html("emailul aparține altui utilizator"); } else { ZEL_account_email_res = 4; $('#ZEL_account_email_resp_cont').html("eroare necunoscută"); } $('#ZEL_account_email_resp_cont').css("display", "flex"); $('#ZEL_account_email_wait_cont').hide(); ZEL_account_email_check_working = 0; } }); } else { ZEL_account_email_res = 3; $('#ZEL_account_email_wait_cont').hide(); $('#ZEL_account_email_resp_cont').css("display", "flex"); $('#ZEL_account_email_resp_cont').html("email invalid"); } } function ZEL_account_pass_check() { var strength; var pass = $('#ZEL_account_password').val(); var comm; if (pass=="") { $('#ZEL_account_pass_resp_cont').hide(); $('#ZEL_account_pass_resp_cont').html(""); } else { strength = Zpass_strength(pass); $('#ZEL_account_pass_resp_cont').css("display", "flex"); if (strength>=75) { comm = " - OK"; } else { comm = " - prea mică"; } $('#ZEL_account_pass_resp_cont').html("Calitate: "+strength+"%" + comm); } } function ZEL_account_form_login_check() { var email = $('#ZEL_account_email').val(); var password = $('#ZEL_account_password').val(); if ($('#ZEL_account_recaptcha_cont').length) { var response = grecaptcha.getResponse(); if (response=="") { Zalert('Nu ai bifat reCaptcha.'); return false; } } if (email.trim() == '') { Zalert('Lipsește adresa de email.'); return false; } if (password.trim() == '') { Zalert('Lipsește parola.'); return false; } return true; } function ZEL_account_form_check() { var working = ZEL_account_email_check_working; var email_result = ZEL_account_email_res; var email = $('#ZEL_account_email').val(); var first_name = $('#ZEL_account_first_name').val(); var last_name = $('#ZEL_account_last_name').val(); var password = $('#ZEL_account_password').val(); var password_conf = $('#ZEL_account_password_conf').val(); var IDuser = $('#ZEL_account_IDuser').val(); IDuser=parseInt(IDuser); if (isNaN(IDuser)) { IDuser = 0; } if (working == "1") { Zalert('Waiting for the email validation response. Please wait.'); return false; } if (email.trim() == "") { Zalert('Lipsește adresa de email.'); return false; } if (email_result == "1") { // Email is OK } else if(email_result == "2") { Zalert('Emailul aparține altui utilizator.'); return false; } else if (email_result == "3") { Zalert('Formatul adresei de email este gresit.'); return false; } else if (email_result == "0") { Zalert('Lipsește adresa de email.'); return false; } else { Zalert('Unknown error.'); return false; } if (first_name.trim() == '') { Zalert('Lipsește prenumele.'); return false; } if (last_name.trim() == '') { Zalert('Lipsește numele de familie.'); return false; } if (IDuser==0) { if (password.trim() == '') { Zalert('Lipsește parola.'); return false; } else if (Zpass_strength(password) < 75) { Zalert('Calitatea parolei este sub 75%.'); return false; } else if (password !== password_conf) { Zalert('Parola nu este corect confirmată.'); return false; } } return true; } function ZEL_account_form_chp_check() { var password_old = $('#ZEL_account_password_old').val(); var password = $('#ZEL_account_password').val(); var password_conf = $('#ZEL_account_password_conf').val(); if (password_old.trim() == '') { Zalert('Lipsește parola veche.'); return false; } else if (password.trim() == '') { Zalert('Lipsește parola.'); return false; } else if (Zpass_strength(password) < 75) { Zalert('Calitatea parolei este sub 75%.'); return false; } else if (password !== password_conf) { Zalert('Parola nu este corect confirmată.'); return false; } } function ZEL_account_form_reset_init_check() { var email = $('#ZEL_account_email').val(); if (email.trim() == '') { Zalert('Lipsește adresa de email.'); return false; } return true; } function ZEL_account_form_reset_change_check() { var password = $('#ZEL_account_password').val(); var password_conf = $('#ZEL_account_password_conf').val(); if (password.trim() == '') { Zalert('Lipsește parola.'); return false; } else if (Zpass_strength(password) < 75) { Zalert('Calitatea parolei este sub 75%.'); return false; } else if (password !== password_conf) { Zalert('Parola nu este corect confirmată.'); return false; } return true; } function ZEL_account_book_page_go(IDbook, page, from_acci) { var url = Zset.http+'account/v/acci/13/IDbook/'+IDbook+'/page/'+page+'/fra/'+from_acci; window.location.href = url; } //========== END: account =========