var documentRoot = "registration/resetPassword/"; var showSuccessSlide = function (feedback) { $("#successSlide").html(feedback); $("#successSlide").show(); $("#defaultSlide").hide(); }; function sendLink() { if (document.frm.email.value != "") { $.post(documentRoot + 'sendmail.php', {'email': document.frm.email.value}, function (feedback) { showSuccessSlide(feedback); }); } else { showNotification(messages.emailRequired); } } var showNotification = function (notification, element) { var errorContainer = $("#error-log"); if (!notification) { errorContainer.html(''); $('.taf-error').removeClass('taf-error'); return; } if (element instanceof jQuery) element.addClass('error'); var n = $('
').html(notification); errorContainer.append(n); } var passwordStrength = null; function changePass() { var ww = document.frm.password.value; var ww2 = document.frm.passwordAgain.value; if (ww != ww2) { showNotification(messages.passwordsDoNotMatch); return false; } if (ww == "") { showNotification(messages.passwordRequired); return false; } checkPass(); if (!passwordStrength.isValid()) { return false; } $("#log").html(""); $.post(documentRoot + "newPassword.php", { 'password': ww, 'passwordAgain': ww2, "logins_id": document.frm.id.value, "code": document.frm.code.value }, function (feedback) { if (feedback == "x") { showSuccessSlide(messages.success); } else { showSuccessSlide(feedback); } }).fail(function () { alert("Request error"); }); } function checkPass() { if (!passwordStrength) { passwordStrength = new PasswordStrength(); } var pass = document.frm.password.value; passwordStrength.setPassword(pass, passwordChangeUserName); } function onPasswordChange() { checkPass(); sv.notify(undefined, true); passwordStrength.getSuggestions().forEach(function (e) { sv.notify(e, false); }); }