From 6217e9004fca2518f2db91012df5986dd6930770 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 17 Apr 2015 16:40:22 -0500 Subject: [PATCH] IDEMPIERE-2558 don't allow use old password when change password / all SQL in core must be in oracle syntax --- .../org/compiere/model/MPasswordHistory.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MPasswordHistory.java b/org.adempiere.base/src/org/compiere/model/MPasswordHistory.java index 016d090e80..f32e93cdb5 100644 --- a/org.adempiere.base/src/org/compiere/model/MPasswordHistory.java +++ b/org.adempiere.base/src/org/compiere/model/MPasswordHistory.java @@ -35,19 +35,11 @@ public class MPasswordHistory extends X_AD_Password_History { * @return */ public static List getPasswordHistoryForCheck (int daysReuse, int userId){ - StringBuilder whereClause = new StringBuilder(); - // note: because we use current_date, it's date => subtract make a interval of date + house + ... - // extrack day will get day range - // TODO:need recheck in oracle - whereClause.append("extract (day from (current_date - "); - whereClause.append(MPasswordHistory.COLUMNNAME_DatePasswordChanged); - whereClause.append(")) <= "); - whereClause.append(daysReuse); - - whereClause.append(" AND "); - whereClause.append(MPasswordHistory.COLUMNNAME_AD_User_ID); - whereClause.append(" = "); - whereClause.append(userId); + StringBuilder whereClause = new StringBuilder() + .append("SYSDATE-") + .append(daysReuse) + .append("<=DatePasswordChanged AND AD_User_ID=") + .append(userId); Query query = new Query(Env.getCtx(), MPasswordHistory.Table_Name, whereClause.toString(), null); query.setClient_ID(true);