Files
matrix/cygnus-onprem-app/build/WebContent/js/appjs/cpass.js

41 lines
1.3 KiB
JavaScript

function ValidateSubmitCP()
{
validate(document.getElementById("curpass"),'t','Remarks');
validate(document.getElementById("newpass"),'t','Remarks');
validate(document.getElementById("rnewpass"),'t','Remarks');
if(checkForm())
{
var p0=$("#curpass").val();
var p1=$("#newpass").val();
var p2=$("#rnewpass").val();
if(p1.length < 8 || p1.length > 20)
{
highlightField(document.getElementById("newpass"));
CallMessage('6666CPASS:Error:Password should have atleast 8 characters and maximum 20 characters.',3000,200,300);
return false;
}
else if(p1!=p2)
{
highlightField(document.getElementById("newpass"));
highlightField(document.getElementById("rnewpass"));
CallMessage('6666CPASS:Error:Mismatch found in new passwords.',3000,200,300);
return false;
}
else if(p0==p1)
{
highlightField(document.getElementById("curpass"));
highlightField(document.getElementById("newpass"));
CallMessage('6666CPASS:Error:Current password and new password could not be same.',3000,200,300);
return false;
}
else
{
SubmitForm("changepass", "_parent", "logkey");
}
}
else
{
CallMessage('6666CPASS:error:There are one or more error(s) in form. Please correct them and try again.',3000,200,300);
}
}