if (location.protocol != "https:") {
var protocol = "http://";
} else {
var protocol = "https://";
}
var urlarr = window.location.pathname.split("/");
var $url = protocol + window.location.host + "/";
var $hoststr = "";
console.log(urlarr.length);
for (var j = 1; j < urlarr.length - 2; j++) {
$hoststr += window.location.pathname.split("/")[j] + "/";
}
var db = window.location.pathname.split("/")[urlarr.length - 2];
$host_url = $url + $hoststr + "app.php?db=" + db + "&a=";
function callUserPasswordReset() {
$("#page_main_div").load(
"../html_modules/userpasswordreset.html",
function () {
document.getElementById("display_module_name").innerHTML =
"Reset password";
document.getElementById("module_name_for_save").value = "Reset password";
getDefaultHeadFooterLinks("Reset password");
userdata();
}
);
}
function userdata() {
// var colle_code = document.getElementById("collge_code").value;
$.ajax({
type: "GET",
url: $host_url + "passwordresetforuser",
// data: "collge_code=" + colle_code,
success: function (res) {
var response = JSON.parse(res);
console.log(response.data.data, "hiiii");
if (response.status == "success") {
let table = "";
table += `
`;
document.getElementById("tabledata").innerHTML = table;
}
},
});
}
function reset(collcode, uname) {
$("#passwordtable").show();
$("#resetbutton").hide();
// $("#backtoresetpage").show();
console.log("vjhdschsvch");
document.getElementById("collcode").value = collcode;
document.getElementById("user").value = uname;
document.getElementById("user").disabled = true;
return;
}
function passwordrequired() {
var myInput = document.getElementById("newpass");
var letter = document.getElementById("letter");
var capital = document.getElementById("capital");
var number = document.getElementById("number");
var length = document.getElementById("length");
myInput.onkeyup = function () {
var lowerCaseLetters = /[a-z]/g;
if (myInput.value.match(lowerCaseLetters)) {
letter.classList.remove("invalid");
letter.classList.add("valid");
} else {
letter.classList.remove("valid");
letter.classList.add("invalid");
}
// Validate capital letters
var upperCaseLetters = /[A-Z]/g;
if (myInput.value.match(upperCaseLetters)) {
capital.classList.remove("invalid");
capital.classList.add("valid");
} else {
capital.classList.remove("valid");
capital.classList.add("invalid");
}
// Validate numbers
var numbers = /[0-9]/g;
if (myInput.value.match(numbers)) {
number.classList.remove("invalid");
number.classList.add("valid");
} else {
number.classList.remove("valid");
number.classList.add("invalid");
}
// Validate length
if (myInput.value.length >= 8) {
length.classList.remove("invalid");
length.classList.add("valid");
} else {
length.classList.remove("valid");
length.classList.add("invalid");
}
};
}
function handleSubmit() {
var colle_code = document.getElementById("collcode").value;
var user = document.getElementById("user").value;
var newpass = document.getElementById("newpass").value;
var comfirmpass = document.getElementById("confirmpass").value;
if (newpass == comfirmpass) {
$.ajax({
type: "POST",
url: $host_url + "newpasswordsubmit",
data:
"collge_code=" +
colle_code +
"&confirmpass=" +
comfirmpass +
"&user=" +
user,
success: function (res) {
var response = JSON.parse(res);
console.log(response, "bsdhv");
if (response.status == "success") {
alert("Password Update Successfully");
}
},
});
} else {
alert("Newpassword and Confirmpassword should be same!");
}
}
function backtoresetpage() {
// window.location.href = "userpasswordreset.html";
$("#page_main_div").load("../html_modules/userpasswordreset.html");
userdata();
}