PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 1.0.92
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v1.0.92
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
fluent-community / assets / user_registration_js.js

user_registration_js.js in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 1.0.92, at assets/user_registration_js.js

2 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 document.addEventListener("DOMContentLoaded",function(){function c(e){const o=[];if(typeof e=="object"&&e.join===void 0)for(const n in e)o.push(c(e[n]));else if(typeof e=="object"&&e.join!==void 0)for(const n in e)o.push(c(e[n]));else typeof e=="function"||typeof e=="string"&&o.push(e);return o.join("<br />")}function s(e,o=null,n=null){if(e&&n)if(e=c(e),o){const i=n.querySelector(`[name="${o}"]`);if(!i){s(e,null,n);return}const a=document.createElement("div");a.className="fcom_field_error fcom_field_error",a.innerHTML=e;let r=i.closest(".fcom_form-group");r?(r.classList.add("fcom_has_error"),r.appendChild(a)):s(e,null,n)}else{const i=document.createElement("div");i.className="fcom_field_error fcom_global_error",i.innerHTML=e,n.appendChild(i)}}function f(e){e.querySelectorAll(".fcom_form_input input").forEach(function(o){o.addEventListener("blur",function(){o.closest(".fcom_form-group").classList.remove("fcom_has_error")})}),e.addEventListener("submit",function(o){o.preventDefault(),e.querySelectorAll(".fcom_field_error").forEach(function(t){t.remove()}),e.querySelectorAll(".fcom_has_error").forEach(function(t){t.classList.remove("fcom_has_error")});const i=e.querySelector('button[type="submit"]');i.classList.add("fcom_loading"),i.setAttribute("disabled","disabled");const a=new FormData(e),r=new XMLHttpRequest;r.open("POST",window.fluentComRegistration.ajax_url,!0),r.send(a),r.onload=function(){if(i.classList.remove("fcom_loading"),i.removeAttribute("disabled"),r.status>=200&&r.status<300){let t=r.responseText;if(!t||t.indexOf("<!DOCTYPE html>")!==-1){s("Something went wrong. Please try again later",null,e),window.location.reload();return}const l=JSON.parse(r.responseText);if(l.verifcation_html){let _=e.getElementsByClassName("fcom_form_main_fields");_.length>0&&(_[0].style.display="none");let p=e.querySelector(".fcom_verification_wrap");p&&p.remove();let u=document.createElement("div");u.className="fcom_verification_wrap",u.innerHTML=l.verifcation_html,e.appendChild(u)}else if(l.redirect_url){window.location.href=l.redirect_url,i.innerText="Redirecting...";return}else l.success_html?document.getElementById("fcom_user_onboard_wrap").innerHTML=l.success_html:s("Something went wrong. Please try again later",null,e)}else{const t=JSON.parse(r.responseText);if((!t||!t.message)&&s("Something went wrong. Please try again later",null,e),s(t.message,null,e),t.errors)for(const l in t.errors)s(t.errors[l],l,e)}}})}let d=document.getElementById("fcom_user_registration_form");d&&f(d);let m=document.getElementById("fcom_user_login_form");if(m&&f(m),window.fluentComRegistration&&window.fluentComRegistration.is_logged_in){const e=document.getElementById("fcom_user_accept_form");e&&e.addEventListener("submit",function(o){o.preventDefault();const n=e.querySelector('button[type="submit"]');n.classList.add("fcom_loading"),n.setAttribute("disabled","disabled"),e.querySelectorAll(".fcom_field_error").forEach(function(t){t.remove()});const a=new FormData(e),r=new XMLHttpRequest;r.open("POST",window.fluentComRegistration.ajax_url,!0),r.send(a),r.onload=function(){if(n.classList.remove("fcom_loading"),n.removeAttribute("disabled"),r.status>=200&&r.status<300){const t=JSON.parse(r.responseText);if(t.redirect_url){window.location.href=t.redirect_url,n.innerText="Redirecting...";return}else s("Something went wrong. Please try again later",null,e)}else{const t=JSON.parse(r.responseText);!t||!t.message?s("Something went wrong. Please try again later",null,e):s(t.message,null,e)}}})}});
2