Commit b842ae75 authored by pkamble's avatar pkamble

To check passWdComplexity

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@209054 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9e807640
......@@ -5,6 +5,7 @@ import java.security.MessageDigest;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Random;
import javax.ejb.Stateless; // added for ejb3
......@@ -14,6 +15,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
//import ibase.webitm.utility.GenericUtility;
import ibase.utility.E12GenericUtility;
......@@ -217,7 +219,23 @@ public class SysGenPassword extends ValidatorEJB implements SysGenPasswordLocal
refId = "newrefno";
}
PassWordGenerator passWordGenerator = new PassWordGenerator();
// Added by Pravin K on 07-OCT-19 [to check passWdComplexity ] START
String enterprise = getValueFromXTRA_PARAMS(xtraParams, "enterprise");//
String transDB = getValueFromXTRA_PARAMS(xtraParams, "transDB");
//String passWdComplexity = getDBColumnValue("ENTERPRISE", "PASSWORD_COMPLEXITY", "WHERE ENTERPRISE = '"+enterprise+"'", transDB);
String passWdComplexity = getPassWdComplexity(enterprise, transDB);
System.out.println("SysGenPassword::executepreSaveForm::passWdComplexity =["+passWdComplexity+"]");
if("1".equals(passWdComplexity))
{
genPassWord = ""+(new Random().nextInt(9000)+1000);
}
else
{
genPassWord = passWordGenerator.password(userId);
}
// Added by Pravin K on 07-OCT-19 [to check passWdComplexity ] END
passWordGenerator = null;
System.out.println("genPassWord =["+genPassWord+"]");
valueXmlString.append("<pass_wd>").append("<![CDATA[" + genPassWord + "]]>").append("</pass_wd>");
......@@ -404,4 +422,81 @@ public class SysGenPassword extends ValidatorEJB implements SysGenPasswordLocal
}
//End changes by Rakesh
// Added by Pravin K on 07-OCT-19 [to check passWdComplexity ] START
public String getPassWdComplexity( String enterprise, String transDB ) throws ITMException
{
String sql = "";
String returnValue = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
Connection conn = null;
try
{
ConnDriver connDriver = new ConnDriver();
if(transDB != null && !"null".equalsIgnoreCase(transDB.trim()) && transDB.trim().length() > 0)
{
conn = connDriver.getConnectDB( transDB );
}
else
{
conn = connDriver.getConnectDB( "Driver" );
}
sql = " SELECT PASSWORD_COMPLEXITY FROM ENTERPRISE WHERE ENTERPRISE = " + enterprise ;
pstmt = conn.prepareStatement( sql );
rs = pstmt.executeQuery();
if( rs.next() )
{
returnValue = rs.getString( 1 );
}
if( rs !=null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
catch( Exception exp )
{
System.out.println("Excepton in getDBColumnValue -- >"+exp);
exp.printStackTrace();
throw new ITMException(exp);
}
finally
{
try
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn !=null)
{
conn.close();
conn = null;
}
}
catch(SQLException se)
{
se.printStackTrace();
throw new ITMException(se);
}
}
return returnValue;
}
// Added by Pravin K on 07-OCT-19 [to check passWdComplexity ] END
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment