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 : 3.129.70.138


Current Path : /var/www/html/gcg/pgcet_stop/js/
Upload File :
Current File : /var/www/html/gcg/pgcet_stop/js/forgot-password.js

var fewSeconds = 30;
$("#btn_recover").click(function() {
  // Ajax request
  var btn = $(this);
  btn.prop("disabled", true);
  setTimeout(function() {
    btn.prop("disabled", false);
  }, fewSeconds * 1000);
});
function recover() {
  if (!$("#mobile").val()) {
    return;
  }
  var mobile = $("#mobile").val();
  var parameters = "&mobile=" + mobile;
  $.ajax({
    type: "post",
    url: "forgot-password.php",
    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: "resetpassword.php",
    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"
});