}else{
//external use case
userid = ea.getUserid();
empid = 0;
}
OTP indatabase = otpBO.findAccountByName(userid,empid);
//suppose user provided valid one-time-password
java.util.Date current_date = new java.util.Date();
java.sql.Timestamp current_timestamp = new java.sql.Timestamp(current_date.getTime());
long current_time = current_timestamp.getTime();
long db_time = indatabase.gettime().getTime();
long time_diff = current_time - db_time; //5 minutes = 5 * 60 * 1000 (ms) =300,000
// Need to be modified!!!
if(oneTimePassword.equals(indatabase.getotp()) && time_diff < 300000){
System.out.println("Ok!!!");
// delete the one time login entry
otpBO.delete(indatabase);
//set first time login to false