0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 52.15.113.71


Current Path : /var/www/html/pget/js/pg/
Upload File :
Current File : //var/www/html/pget/js/pg/forgot-password.js

var fewSeconds = 30;
var db = window.location.pathname.split("/")[2];

$("#btn_recover").click(function () {
  // Ajax request
  var btn = $(this);
  btn.prop("disabled", true);
  setTimeout(function () {
    btn.prop("disabled", false);
  }, fewSeconds * 1000);
});
function recover() {
  if (!$("#forgot_password_Email").valid()) {
    return;
  }
  var mobile = $("#mobile").val();
  var parameters = "&mobile=" + mobile;
  $.ajax({
    type: "post",
    url: "../pgetadm/forgot-password.php?db=" + db,
    data: parameters,
    success: function (response) {
      var { status, femail, msg } = JSON.parse(response);
      if (status === "success") {
        swal({
          title: msg,
          type: "success",
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: true,
        });
        $("#btn_recover").html("Resend-OTP");
        return;
      } else {
        swal({
          title: msg,
          type: "warning",
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: true,
        });
        $("#confirm").html(msg);
        return;
      }
    },
  });
}

function resetPasswd() {
  if (!$("#resetpasswordform").valid()) {
    return;
  }
  var parameters = `&mobile=${$("#mobile").val()}&otp=${$("#motp").val()}
    &password=${$("#cpassword").val()}`;

  $.ajax({
    type: "post",
    url: "../pgetadm/resetpassword.php?db=" + db,
    data: parameters,
    success: function (response) {
      var { status } = JSON.parse(response);
      if (status === "success") {
        swal(
          {
            title: "password reset successful",
            type: "success",
            showCancelButton: false,
            confirmButtonColor: "#5495ff",
            confirmButtonText: "OK",
            closeOnConfirm: false,
          },
          function () {
            window.location.href = "index.html";
          }
        );
      } else {
        swal({
          title: "Invalid OTP",
          type: "warning",
          showCancelButton: false,
          confirmButtonColor: "#5495ff",
          confirmButtonText: "OK",
          closeOnConfirm: true,
        });
      }
    },
  });
}

$("#resetpasswordform").validate({
  rules: {
    terms: {
      required: true,
    },
    confirm: {
      equalTo: '[name="password"]',
    },
  },
  highlight: function (input) {
    $(input).parents(".form-line").addClass("error");
  },
  unhighlight: function (input) {
    $(input).parents(".form-line").removeClass("error");
  },
  errorPlacement: function (error, element) {
    $(element)
      .parents(".inner-addon")
      .append(error)
      .find("label")
      .css("color", "red");
  },
});

$("input[type=password]").tooltip({
  placement: "top",
  trigger: "focus",
});