toastr.clear();
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": false,
"positionClass": "toast-bottom-center",
"preventDuplicates": true,
"showDuration": "6000",
"hideDuration": "10000",
"timeOut": "3000",
"extendedTimeOut": "2000"
};
$(document).ready(function() {
$("#st_forgotform").submit(function(){
$("#st_forgotform button[type='submit']").html('Please wait');
$("#st_forgotform button[type='submit']").attr("disabled","true");
$.ajax({
url: "https://wbtcemp.in/forgot-password-action",
type: "POST",
data: new FormData($("#st_forgotform")[0]),
async: true,
contentType: false,
cache: false,
processData:false,
success: function(data) {
$("#st_forgotform button[type='submit']").html("Send Reset Link");
$("button[type='submit']").removeAttr("disabled");
if(data == 'ok')
{
window.location = "forgot-password-otp";
//toastr.success(" Your reset link has been generated successfully and sent to your mail id!");
//$(".page-ath-text").removeClass("hide");
//$("#st_forgotform").addClass("hide");
}
else
{
toastr.warning(""+data);
}
},
error: function(xhr, ajaxOptions, thrownError) {
toastr.error(' Failed! Something is wrong.');
$("#st_forgotform button[type='submit']").html("Send Reset Link");
$("#st_forgotform button[type='submit']").removeAttr("disabled");
}
});
return false;
});
$("#st_resetform").submit(function(){
$("#st_resetform button[type='submit']").html('Please wait');
$("#st_resetform button[type='submit']").attr("disabled","true");
$.ajax({
url: "https://wbtcemp.in/forgot-password-reset-action",
type: "POST",
dataType:"json",
data: new FormData($("#st_resetform")[0]),
async: true,
contentType: false,
cache: false,
processData:false,
success: function(data) {
toast_type = data.type;
$("#st_resetform button[type='submit']").html('Submit');
$("button[type='submit']").removeAttr("disabled");
if(data.type=="success")
{
$(".page-ath-text").removeClass("hide");
$("#st_resetform").addClass("hide");
}
if(toast_type=='success')
{
toastr.success(''+data.text);
}
else
{
toastr.warning(''+data.text);
}
},
error: function(xhr, ajaxOptions, thrownError) {
toastr.error(' Failed! Something is wrong.');
$("#st_resetform button[type='submit']").html('Submit');
$("#st_resetform button[type='submit']").removeAttr("disabled");
}
});
return false;
});
$("#otp_verification_regn_btn").click(function(){
var error = "";
$("#otp_verification_regn_btn").html('Please wait');
$("#otp_verification_regn_btn").addClass("disabled");
$.ajax({
url: "https://wbtcemp.in/forgot-password-regn",
type: "POST",
dataType:"json",
data: new FormData($("#st_regform")[0]),
async: true,
contentType: false,
cache: false,
processData:false,
success: function(data) {
toast_type = data.type;
$("#otp_verification_regn_btn").html('Resend OTP?');
$("#otp_verification_regn_btn").removeClass("disabled");
toastr.clear();
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": false,
"positionClass": "toast-bottom-center",
"preventDuplicates": true,
"showDuration": "1000",
"hideDuration": "10000",
"timeOut": "2000",
"extendedTimeOut": "1000"
};
if(toast_type=='success')
{
toastr.success(''+data.text);
}
else
{
toastr.warning(''+data.text);
}
},
error: function(xhr, ajaxOptions, thrownError) {
toastr.clear();
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": false,
"positionClass": "toast-bottom-center",
"preventDuplicates": true,
"showDuration": "6000",
"hideDuration": "10000",
"timeOut": "3000",
"extendedTimeOut": "2000"
};
toastr.error(' Failed! Something is wrong.');
$("#otp_verification_regn_btn").html('Resend OTP?');
$("#otp_verification_regn_btn").removeClass("disabled");
}
});
return false;
});
$("#uniqueid").change(function(){
$("#email_phnumber").val('');
$.ajax({
url: "https://wbtcemp.in/forgot-password-check-u",
type: "POST",
data: "val="+this.value,
success: function(data) {
if(data!=0)
{
$("#email_phnumber").val(data);
}
else
{
$("#email_phnumber").val('');
toastr.clear();
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": false,
"positionClass": "toast-bottom-center",
"preventDuplicates": true,
"showDuration": "6000",
"hideDuration": "10000",
"timeOut": "3000",
"extendedTimeOut": "2000"
};
toastr.error(' You entered invalid User ID/profile id!');
}
},
error: function(xhr, ajaxOptions, thrownError) {
toastr.clear();
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": false,
"positionClass": "toast-bottom-center",
"preventDuplicates": true,
"showDuration": "6000",
"hideDuration": "10000",
"timeOut": "3000",
"extendedTimeOut": "2000"
};
toastr.error(' Failed! Something is wrong.');
$("#email_phnumber").val('');
}
});
});
});
// For Validation minimum char in Last-Name
function validatePassword(password) {
var password_val = $("#"+password).val();
var regex = /^([0-9a-zA-Z/#?!@$%^&*-+]){4,8}$/;
if(regex.test(password_val)) {
//return false;
}
else{
$("#"+password).val('');
$("#"+password).focus();
toastr.warning(' Invalid Password. Enter minimum 4 and maximum 8 characters');
}
}