Commit 9a927c45 authored by pkamble's avatar pkamble

Password generation related Changes

  - Get user info from ValidatorEJB
  - Remove "error throwing" from getPassWdComplexity() method

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@209064 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b842ae75
......@@ -20,6 +20,7 @@ import ibase.utility.CommonConstants;
//import ibase.webitm.utility.GenericUtility;
import ibase.utility.E12GenericUtility;
import ibase.utility.EMail;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
......@@ -218,25 +219,30 @@ 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);
UserInfoBean userInfoBean = getUserInfo();
String enterprise = userInfoBean.getEnterprise();
String transDB = userInfoBean.getTransDB();
System.out.printf("SysGenPassword :: executepreSaveForm() : enterprise: [%s], transDB: [%s]\n", enterprise, transDB);
String passWdComplexity = getPassWdComplexity(enterprise, transDB);
System.out.println("SysGenPassword::executepreSaveForm::passWdComplexity =["+passWdComplexity+"]");
if("1".equals(passWdComplexity))
System.out.printf("SysGenPassword :: executepreSaveForm : passWdComplexity: [%s]\n", passWdComplexity);
PassWordGenerator passWordGenerator = null;
if ("1".equals(passWdComplexity))
{
genPassWord = ""+(new Random().nextInt(9000)+1000);
genPassWord = String.valueOf((new Random().nextInt(9000) + 1000));
}
else
{
passWordGenerator = new PassWordGenerator();
genPassWord = passWordGenerator.password(userId);
passWordGenerator = null;
}
// 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>");
......@@ -423,10 +429,8 @@ 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
public String getPassWdComplexity(String enterprise, String transDB)
{
String sql = "";
String returnValue = null;
PreparedStatement pstmt = null;
......@@ -435,66 +439,45 @@ public class SysGenPassword extends ValidatorEJB implements SysGenPasswordLocal
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 );
conn = connDriver.getConnectDB(transDB);
sql = "SELECT PASSWORD_COMPLEXITY FROM ENTERPRISE WHERE ENTERPRISE=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, enterprise);
rs = pstmt.executeQuery();
if( rs.next() )
if (rs.next())
{
returnValue = rs.getString( 1 );
returnValue = rs.getString("PASSWORD_COMPLEXITY");
}
if( rs !=null )
{
rs.close();
rs = null;
}
if( pstmt != null )
catch (Exception exp)
{
pstmt.close();
pstmt = null;
}
}
catch( Exception exp )
{
System.out.println("Excepton in getDBColumnValue -- >"+exp);
System.out.println("Excepton in getDBColumnValue -- >" + exp);
exp.printStackTrace();
throw new ITMException(exp);
}
finally
{
try
{
if(rs!=null)
if (rs!= null)
{
rs.close();
rs = null;
}
if(pstmt != null)
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn !=null)
if (conn != null)
{
conn.close();
conn = null;
}
}
catch(SQLException se)
{
se.printStackTrace();
throw new ITMException(se);
}
catch(SQLException 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