getTemplateHTML(); function getTemplateHTML() { $.ajax({ type: "POST", dataType: "html", contentType: "application/x-www-form-urlencoded; charset=UTF-8", url: "/sde65/login?action=getTemplateHtml", success: function(html) { var zz=$("#SYS_LOGIN_INPUTS").clone().html(); html=html.replace("<##SYS_LOGIN_INPUTS##>",zz) $("#SYS_LOGIN_INPUTS").empty(); $("#htmlTemplate").parent().empty().html(html); setTriggerOnInputs(); }, error: function(req, textStatus, errorThrown){ } }); } function actionforgetPassword() { $("#divAlert").addClass("hidden"); $.ajax({ url: "/sde65/login?action=sendNewPassword", type: "POST", data: { login : $("#inputLogin").val() }, dataType: "text", contentType: "application/x-www-form-urlencoded; charset=UTF-8", success: function(result) { $("#divAlert").removeClass("hidden"); $("#alertMessage").html("Votre identifiant et un nouveau mot de passe viennent de vous être envoyés par email."); var delayInMilliseconds = 3000; //3 second setTimeout(function() { window.location.href = "/sde65/login"; }, delayInMilliseconds); }, error: function(req,textStatus,errorThrown){ debugger; $("#divAlert").removeClass("hidden"); $("#alertMessage").html(req.responseText); } }); } const onforgetPasswordValidation = () => { actionforgetPassword(); } function setTriggerOnInputs() { $("#inputLogin").on("keyup", function(e) { if(e.originalEvent.key == "Enter"){ e.preventDefault(); onforgetPasswordValidation() } }); $("#validation").on("click", function(e) { e.preventDefault(); onforgetPasswordValidation() }); }