Hi,

Requirement : To validate password and emailID entered by user.
I have designed a dialog for user to enter there email id and password for creating their new account.

I want the the user input to be validated on the "next" button of the dialog.
I have written a javascript for it as below and added a custom action in "do action" of my dialog button.In custom action I have called PasswordValidation function.

function PasswordValidation()
{
var Passwordportal = Session.Property("PASSWORDPORTAL");
var patt = /^[A-Za-z0-9]{6,20}$/;
var passvalid = patt.test(Passwordportal);
if (passvalid)
{
GetMd5();
Session.Property("PASSVALIDFLAG") = "0";
return true;
}

Session.Property("PASSVALIDFLAG") = "1";
alert("Password should have 6 to 20 characters with a digit and alphabet")
return false;

}
function GetMd5()
{
var szPostgrePath = Session.Property("PGLOCATION");
var szPgPAssword = Session.Property("DBPASSWORD");
var szUsername = Session.Property("DBUSERID");
var szDataBase = Session.Property("DBNAME");
var szHostname = Session.Property("SERVERIP");
var szPasswordportal = Session.Property("PASSWORDPORTAL");


var cmdLine = '%comspec% /c set \"PGPASSWORD='+szPgPAssword+'\" & \"' + szPostgrePath + '\\bin\\psql.exe\" -U '+szUsername+' -d '+szDataBase+' -h '+szHostname+' -t -c \"SELECT MD5(\''+szPasswordportal+'\')\"';
Session.Property("ENCRYPTEDPWD") = getCommandOutput(cmdLine);
var encrypted = Session.Property("ENCRYPTEDPWD");
//encrypted = encrypted.replace(/\s+/g, ' ').trim();
//var res = encrypted.split("/n");

//encrypted = res[0];
encrypted = encrypted.replace(/(\r\n|\n|\r)/gm,"");
//encrypted = encrypted.substring(1,33);
Session.Property("ENCRYPTEDPWDnew") = encrypted;

var szEncryptedPwd = Session.Property("ENCRYPTEDPWDnew");
var szPortalUser = Session.Property("USERPORTAL");

var cmdlinenew = '%comspec% /c set \"PGPASSWORD='+szPgPAssword+'\" & \"' + szPostgrePath + '\\bin\\psql.exe\" -U '+szUsername+' -d '+szDataBase+' -h '+szHostname+' -t -c \"Update users set \\\"UserName\\\"=\''+szPortalUser+'\',\\\"Password\\\"=\''+szEncryptedPwd+'\' Where \\\"UserId\\\"=1\"';
Session.Property("CMDLINEUPDATE") = cmdlinenew;
Session.Property("UPDATECMDOUTPUT") = getCommandOutput(cmdlinenew);
}




But this JS is not getting executed successfully.

Can someone help me out with this?