From bf5e689eeff0227965a1a9b35bce106d901e2384 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Tue, 11 Sep 2012 12:42:43 +0800 Subject: [PATCH 1/2] IDEMPIERE-270 Reports should inherit search filter from window - revise create print format item logic and report window popup --- .../src/org/compiere/print/MPrintFormat.java | 5 +- .../org/compiere/print/MPrintFormatItem.java | 87 +++++++++++++++++++ .../webui/panel/AbstractADWindowPanel.java | 40 +-------- .../webui/panel/action/ReportAction.java | 5 +- 4 files changed, 93 insertions(+), 44 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java index cd18c4687d..553ef95208 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java @@ -578,10 +578,7 @@ public class MPrintFormat extends X_AD_PrintFormat int seqNo = 1; for (GridField gridField : gridFields) { - if (gridField.getAD_Column_ID() <= 0) - continue; - - MPrintFormatItem pfi = MPrintFormatItem.createFromColumn (pf, gridField.getAD_Column_ID(), seqNo++); + MPrintFormatItem pfi = MPrintFormatItem.createFromGridField(pf, gridField, seqNo++); if (pfi != null) { printFormatItemList.add (pfi); diff --git a/org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java b/org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java index 8f0bec0378..5c9e1de0c5 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintFormatItem.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.Properties; import java.util.logging.Level; +import org.compiere.model.GridField; import org.compiere.model.X_AD_PrintFormatItem; import org.compiere.util.CCache; import org.compiere.util.CLogger; @@ -513,6 +514,92 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem // pfi.dump(); return pfi; } // createFromColumn + + public static MPrintFormatItem createFromGridField (MPrintFormat format, GridField gridField, int seqNo) + { + if (gridField.getAD_Column_ID() <= 0) + return null; + + MPrintFormatItem pfi = new MPrintFormatItem (format.getCtx(), 0, format.get_TrxName()); + pfi.setAD_PrintFormat_ID (format.getAD_PrintFormat_ID()); + pfi.setClientOrg(format); + pfi.setAD_Column_ID(gridField.getAD_Column_ID()); + pfi.setPrintFormatType(PRINTFORMATTYPE_Field); + + // translation is dome by trigger + String sql = "SELECT c.ColumnName,e.Name,e.PrintName, " // 1..3 + + "c.AD_Reference_ID,c.IsKey,c.SeqNo " // 4..6 + + "FROM AD_Column c, AD_Element e " + + "WHERE c.AD_Column_ID=?" + + " AND c.AD_Element_ID=e.AD_Element_ID"; + // translate base entry if single language - trigger copies to trl tables + Language language = format.getLanguage(); + boolean trl = !Env.isMultiLingualDocument(format.getCtx()) && !language.isBaseLanguage(); + if (trl) + sql = "SELECT c.ColumnName,e.Name,e.PrintName, " // 1..3 + + "c.AD_Reference_ID,c.IsKey,c.SeqNo " // 4..6 + + "FROM AD_Column c, AD_Element_Trl e " + + "WHERE c.AD_Column_ID=?" + + " AND c.AD_Element_ID=e.AD_Element_ID" + + " AND e.AD_Language=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, format.get_TrxName()); + pstmt.setInt(1, gridField.getAD_Column_ID()); + if (trl) + pstmt.setString(2, language.getAD_Language()); + rs = pstmt.executeQuery(); + if (rs.next()) + { + pfi.setName(rs.getString(2)); + pfi.setPrintName(rs.getString(3)); + int displayType = rs.getInt(4); + if (DisplayType.isNumeric(displayType)) + pfi.setFieldAlignmentType(FIELDALIGNMENTTYPE_TrailingRight); + else if (displayType == DisplayType.Text || displayType == DisplayType.Memo ) + pfi.setFieldAlignmentType(FIELDALIGNMENTTYPE_Block); + else + pfi.setFieldAlignmentType(FIELDALIGNMENTTYPE_LeadingLeft); + // + if (displayType == DisplayType.Button || displayType == DisplayType.Binary + || displayType == DisplayType.ID || displayType == DisplayType.Image + || displayType == DisplayType.RowID + || seqNo == 0) + { + pfi.setIsPrinted(false); + pfi.setSeqNo(0); + } + else + { + pfi.setIsPrinted(true); + pfi.setSeqNo(seqNo); + } + int idSeqNo = rs.getInt(6); // IsIdentifier SortNo + if (idSeqNo > 0) + { + pfi.setIsOrderBy(true); + pfi.setSortNo(idSeqNo); + } + } + else + s_log.log(Level.SEVERE, "Not Found AD_Column_ID=" + gridField.getAD_Column_ID() + + " Trl=" + trl + " " + language.getAD_Language()); + } + catch (SQLException e) + { + s_log.log(Level.SEVERE, sql, e); + } + finally { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + if (!pfi.save()) + return null; + // pfi.dump(); + return pfi; + } /** * Copy existing Definition To Client diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index a82c56d2fd..7db0b7384b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -17,6 +17,9 @@ package org.adempiere.webui.panel; +import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_REDO; +import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_UNDO; + import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -38,7 +41,6 @@ import org.adempiere.webui.WZoomAcross; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.BusyDialogTemplate; import org.adempiere.webui.apps.ProcessModalDialog; -import org.adempiere.webui.apps.WReport; import org.adempiere.webui.apps.form.WCreateFromFactory; import org.adempiere.webui.apps.form.WCreateFromWindow; import org.adempiere.webui.apps.form.WPayment; @@ -75,7 +77,6 @@ import org.compiere.model.MProcess; import org.compiere.model.MQuery; import org.compiere.model.MRecentItem; import org.compiere.model.MRole; -import static org.compiere.model.SystemIDs.*; import org.compiere.process.DocAction; import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfoUtil; @@ -2070,41 +2071,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private void onReport0() { ReportAction reportAction = new ReportAction(this); reportAction.show(); -/* // Query - MQuery query = new MQuery(curTab.getTableName()); - // Link for detail records - String queryColumn = curTab.getLinkColumnName(); - // Current row otherwise - if (queryColumn.length() == 0) - queryColumn = curTab.getKeyColumnName(); - // Find display - String infoName = null; - String infoDisplay = null; - for (int i = 0; i < curTab.getFieldCount(); i++) - { - GridField field = curTab.getField(i); - if (field.isKey()) - infoName = field.getHeader(); - if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo") ) - && field.getValue() != null) - infoDisplay = field.getValue().toString(); - if (infoName != null && infoDisplay != null) - break; - } - if (queryColumn.length() != 0) - { - if (queryColumn.endsWith("_ID")) - query.addRestriction(queryColumn, MQuery.EQUAL, - new Integer(Env.getContextAsInt(ctx, curWindowNo, queryColumn)), - infoName, infoDisplay); - else - query.addRestriction(queryColumn, MQuery.EQUAL, - Env.getContext(ctx, curWindowNo, queryColumn), - infoName, infoDisplay); - } - - new WReport (curTab.getAD_Table_ID(), query, toolbar.getEvent().getTarget(), curWindowNo, curTab.getWhereExtended()); -*/ } /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java index 47068bc6d5..4d43f5a1ac 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java @@ -26,7 +26,7 @@ import java.util.logging.Level; import javax.sql.RowSet; -import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.WProcessCtl; import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.ConfirmPanel; @@ -89,7 +89,6 @@ public class ReportAction implements EventListener if(winReport == null) { winReport = new Window(); - winReport.setTitle(Msg.getMsg(Env.getCtx(), "Export") + ": " + panel.getActiveGridTab().getName()); winReport.setWidth("450px"); winReport.setClosable(true); winReport.setBorder("normal"); @@ -161,7 +160,7 @@ public class ReportAction implements EventListener } winReport.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); - AEnv.showWindow(winReport); + LayoutUtils.openPopupWindow(panel.getToolbar().getButton("Report"), winReport, "after_start"); } @Override From 6c787d46547483ef049ed0323ee569fb63c866ba Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Tue, 11 Sep 2012 19:33:10 +0800 Subject: [PATCH 2/2] IDEMPIERE-375 Implement Forgot my Password --- .../oracle/907_IDEMPIERE-375.sql | 354 ++++++++++++++ .../postgresql/907_IDEMPIERE-375.sql | 354 ++++++++++++++ .../src/org/compiere/model/I_AD_User.java | 27 ++ .../src/org/compiere/model/X_AD_User.java | 53 ++- .../src/org/compiere/util/Login.java | 7 +- .../src/org/compiere/apps/ALogin.java | 114 ++++- .../src/org/adempiere/webui/apps/AEnv.java | 14 +- .../webui/panel/ChangePasswordPanel.java | 125 ++++- .../org/adempiere/webui/panel/LoginPanel.java | 57 ++- .../webui/panel/ResetPasswordPanel.java | 430 ++++++++++++++++++ .../adempiere/webui/window/LoginWindow.java | 11 +- 11 files changed, 1506 insertions(+), 40 deletions(-) create mode 100644 migration/360lts-release/oracle/907_IDEMPIERE-375.sql create mode 100644 migration/360lts-release/postgresql/907_IDEMPIERE-375.sql create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java diff --git a/migration/360lts-release/oracle/907_IDEMPIERE-375.sql b/migration/360lts-release/oracle/907_IDEMPIERE-375.sql new file mode 100644 index 0000000000..de9cdfe0ec --- /dev/null +++ b/migration/360lts-release/oracle/907_IDEMPIERE-375.sql @@ -0,0 +1,354 @@ +-- Sep 10, 2012 5:10:21 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsExpired',200126,'D','Expired','Expired','875fbbb0-2513-4a00-9f74-001bceab1f24',0,TO_DATE('2012-09-10 17:10:19','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-09-10 17:10:19','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') +; + +-- Sep 10, 2012 5:10:22 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200126 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Sep 10, 2012 5:10:40 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,114,200456,'U','Y','N','N',0,'N',1,'N',20,'N','N',200126,'N','Y','a5c7128b-3935-41c0-aa78-8541972a7171','N','Y','N','IsExpired','N','Expired','Y',100,TO_DATE('2012-09-10 17:10:39','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-09-10 17:10:39','YYYY-MM-DD HH24:MI:SS'),100,0,0) +; + +-- Sep 10, 2012 5:10:40 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200456 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Sep 10, 2012 5:10:45 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2012-09-10 17:10:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200456 +; + +-- Sep 10, 2012 5:12:01 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +ALTER TABLE AD_User ADD IsExpired CHAR(1) DEFAULT 'N' CHECK (IsExpired IN ('Y','N')) NOT NULL +; + +-- Sep 10, 2012 5:12:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('SecurityQuestion',200127,'D','Security Question','Security Question','11eefd52-bc27-4768-a8ca-71e4c481fd53',0,TO_DATE('2012-09-10 17:12:29','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-09-10 17:12:29','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') +; + +-- Sep 10, 2012 5:12:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200127 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Sep 10, 2012 5:14:35 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,114,200457,'D','N','N','N',0,'N',255,'N',10,'N','N',200127,'N','Y','b92718ad-ac9d-40d7-929a-a1b34d9982fa','N','Y','N','SecurityQuestion','Security Question','Y',100,TO_DATE('2012-09-10 17:14:34','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-09-10 17:14:34','YYYY-MM-DD HH24:MI:SS'),100,0,0) +; + +-- Sep 10, 2012 5:14:35 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200457 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Sep 10, 2012 5:14:43 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +ALTER TABLE AD_User ADD SecurityQuestion NVARCHAR2(255) DEFAULT NULL +; + +-- Sep 10, 2012 5:14:58 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('Answer',200128,'D','Answer','Answer','3d07421f-1ebf-49b1-9b0e-d7d4bbb0cc39',0,TO_DATE('2012-09-10 17:14:57','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-09-10 17:14:57','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') +; + +-- Sep 10, 2012 5:14:58 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200128 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Sep 10, 2012 5:16:45 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,114,200458,'U','N','N','N',0,'N',1024,'N',10,'N','N',200128,'N','Y','cc25c82a-78b7-4831-81a2-4eae10c6b839','N','Y','N','Answer','Answer','Y',100,TO_DATE('2012-09-10 17:16:45','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-09-10 17:16:45','YYYY-MM-DD HH24:MI:SS'),100,0,0) +; + +-- Sep 10, 2012 5:16:45 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200458 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Sep 10, 2012 5:16:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Column SET EntityType='D',Updated=TO_DATE('2012-09-10 17:16:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200458 +; + +-- Sep 10, 2012 5:18:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +ALTER TABLE AD_User ADD Answer NVARCHAR2(1024) DEFAULT NULL +; + +-- Sep 10, 2012 5:19:50 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Reset Password',200044,'D','183be9be-6e0a-4cdc-82fd-c91efabfd586','ResetPassword','Y',TO_DATE('2012-09-10 17:19:49','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 17:19:49','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:19:51 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200044 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:20:14 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Security Question',200045,'D','74df2198-589e-4e80-93c3-6b300c5705b5','SecurityQuestion','Y',TO_DATE('2012-09-10 17:20:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 17:20:13','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:20:14 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200045 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:20:40 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Answer',200046,'D','494db2ce-7749-4f52-82a1-d7e9448ab864','Answer','Y',TO_DATE('2012-09-10 17:20:40','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 17:20:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:20:46 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Answer',200047,'D','397a2656-2199-4451-87fe-5850b54957c0','Answer','Y',TO_DATE('2012-09-10 17:20:45','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 17:20:45','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:21:23 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Security Question is Mandatory',200048,'D','5c73ed0f-6ca9-45bc-8df7-e85f8bc3471d','SecurityQuestionMandatory','Y',TO_DATE('2012-09-10 17:21:22','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 17:21:22','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:21:23 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200048 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:21:43 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Answer is Mandatory',200049,'D','2a9de4c5-671b-4622-a8d4-b0fde148308d','AnswerMandatory','Y',TO_DATE('2012-09-10 17:21:43','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 17:21:43','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:21:43 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200049 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:22:14 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Invalid Security Question and Answer!',200050,'D','2904015f-ffe7-4179-a76d-5748700ea0ee','InvalidSecurityQuestionAndAnswer','Y',TO_DATE('2012-09-10 17:22:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 17:22:13','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:22:14 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200050 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:22:39 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',118,1024,'N','N',200458,'Y',200473,'N','D','Answer','N','Y','2e16932c-92d6-46a0-be21-70164101b156',100,0,TO_DATE('2012-09-10 17:22:38','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2012-09-10 17:22:38','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Sep 10, 2012 5:22:39 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200473 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Sep 10, 2012 5:22:41 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',118,1,'N','N',200456,'Y',200474,'N','D','Expired','N','Y','2b408d81-657b-473b-b425-b97e2d54dd3a',100,0,TO_DATE('2012-09-10 17:22:40','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2012-09-10 17:22:40','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Sep 10, 2012 5:22:41 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200474 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Sep 10, 2012 5:22:41 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',118,255,'N','N',200457,'Y',200475,'N','D','Security Question','N','Y','52bbd8a1-d84e-451d-8b79-63a8db9b9dbe',100,0,TO_DATE('2012-09-10 17:22:41','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2012-09-10 17:22:41','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Sep 10, 2012 5:22:42 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200475 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Sep 10, 2012 5:22:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=200474 +; + +-- Sep 10, 2012 5:22:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 5:22:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=200473 +; + +-- Sep 10, 2012 5:23:06 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=200474 +; + +-- Sep 10, 2012 5:23:06 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 5:23:06 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=200473 +; + +-- Sep 10, 2012 5:23:47 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_DATE('2012-09-10 17:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200474 +; + +-- Sep 10, 2012 5:23:51 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_DATE('2012-09-10 17:23:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 5:24:16 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET IsEncrypted='Y', IsSameLine='Y', IsReadOnly='Y',Updated=TO_DATE('2012-09-10 17:24:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200473 +; + +-- Sep 10, 2012 5:24:20 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET IsEncrypted='Y',Updated=TO_DATE('2012-09-10 17:24:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 5:24:59 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET DisplayLength=20,Updated=TO_DATE('2012-09-10 17:24:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200473 +; + +-- Sep 10, 2012 5:25:02 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET DisplayLength=20,Updated=TO_DATE('2012-09-10 17:25:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 6:23:18 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','What was your childhood nickname?',200051,'D','5f1d8902-cf42-4ebc-ac9a-40e08ccdd0e7','SecurityQuestion_1','Y',TO_DATE('2012-09-10 18:23:17','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 18:23:17','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:23:19 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200051 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 6:23:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Who was your childhood hero?',200052,'D','a6c718d8-1c4d-423d-a075-724c61d897bd','SecurityQuestion_2','Y',TO_DATE('2012-09-10 18:23:29','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 18:23:29','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:23:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200052 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 6:23:42 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','What was the name of your elementary / primary school?',200053,'D','f707f3be-69f3-4c3a-870e-5c366e9b2874','SecurityQuestion_3','Y',TO_DATE('2012-09-10 18:23:41','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 18:23:41','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:23:42 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200053 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 6:23:52 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','What are the last 5 digits of your driver''s license number?',200054,'D','c1e63df5-2df9-4970-ae78-24b75411d166','SecurityQuestion_4','Y',TO_DATE('2012-09-10 18:23:51','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 18:23:51','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:23:52 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200054 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 6:24:04 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Where did you meet your spouse / significant other?',200055,'D','0d1ffdfe-7e55-4796-ba95-7282154fe6fe','SecurityQuestion_5','Y',TO_DATE('2012-09-10 18:24:03','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-10 18:24:03','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:24:04 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200055 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 11, 2012 2:29:52 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET XPosition=4, ColumnSpan=2,Updated=TO_DATE('2012-09-11 14:29:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200473 +; + +-- Sep 11, 2012 2:29:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET ColumnSpan=2,Updated=TO_DATE('2012-09-11 14:29:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Sep 11, 2012 2:31:07 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET XPosition=2, ColumnSpan=2,Updated=TO_DATE('2012-09-11 14:31:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200474 +; + +-- Sep 11, 2012 4:08:26 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO R_MailText (MailText,IsHtml,MailHeader,R_MailText_ID,Name,UpdatedBy,AD_Client_ID,Updated,CreatedBy,AD_Org_ID,IsActive,Created,R_MailText_UU) VALUES ('Dear @Name@, + +You are receiving this email because you (or somebody pretending to be you) said you have lost your iDempiere password. + +To access your iDempiere, use the temporary password from @AD_Client_ID@ below: +@Password@ + +Once you login, you will be directed to change password screen. Please change your password to something you can remember. + +Sincerely, +The iDempiere Accounts Team + +Note: This email address cannot accept replies.','N','iDempiere Reset Password ',200000,'Reset Password',100,0,TO_DATE('2012-09-11 16:08:24','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2012-09-11 16:08:24','YYYY-MM-DD HH24:MI:SS'),'b8938ab2-d3e8-4cc5-9eae-cf27670d2dae') +; + +-- Sep 11, 2012 4:08:26 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO R_MailText_Trl (AD_Language,R_MailText_ID, MailText,MailHeader,MailText2,MailText3,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,R_MailText_Trl_UU ) SELECT l.AD_Language,t.R_MailText_ID, t.MailText,t.MailHeader,t.MailText2,t.MailText3,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, R_MailText t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.R_MailText_ID=200000 AND NOT EXISTS (SELECT * FROM R_MailText_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.R_MailText_ID=t.R_MailText_ID) +; + +-- Sep 11, 2012 6:26:48 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Change Password',200058,'D','1676e190-c252-42c9-b641-76b52145c35c','ChangePassword','Y',TO_DATE('2012-09-11 18:26:46','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-11 18:26:46','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 11, 2012 6:26:48 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200058 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 11, 2012 6:27:32 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Invalid User Name and EMail',200059,'D','cf60c2b0-9d9d-4eed-b04e-496ae2fba7e4','InvalidUserNameAndEmail','Y',TO_DATE('2012-09-11 18:27:31','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-11 18:27:31','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 11, 2012 6:27:32 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200059 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 11, 2012 6:27:51 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Message SET MsgText='Invalid User Name and EMail!',Updated=TO_DATE('2012-09-11 18:27:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200059 +; + +-- Sep 11, 2012 6:27:51 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200059 +; + +SELECT register_migration_script('907_IDEMPIERE-375.sql') FROM dual +; \ No newline at end of file diff --git a/migration/360lts-release/postgresql/907_IDEMPIERE-375.sql b/migration/360lts-release/postgresql/907_IDEMPIERE-375.sql new file mode 100644 index 0000000000..4d03e8d0d9 --- /dev/null +++ b/migration/360lts-release/postgresql/907_IDEMPIERE-375.sql @@ -0,0 +1,354 @@ +-- Sep 10, 2012 5:10:21 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsExpired',200126,'D','Expired','Expired','875fbbb0-2513-4a00-9f74-001bceab1f24',0,TO_TIMESTAMP('2012-09-10 17:10:19','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-09-10 17:10:19','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') +; + +-- Sep 10, 2012 5:10:22 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200126 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Sep 10, 2012 5:10:40 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,114,200456,'U','Y','N','N',0,'N',1,'N',20,'N','N',200126,'N','Y','a5c7128b-3935-41c0-aa78-8541972a7171','N','Y','N','IsExpired','N','Expired','Y',100,TO_TIMESTAMP('2012-09-10 17:10:39','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-09-10 17:10:39','YYYY-MM-DD HH24:MI:SS'),100,0,0) +; + +-- Sep 10, 2012 5:10:40 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200456 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Sep 10, 2012 5:10:45 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2012-09-10 17:10:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200456 +; + +-- Sep 10, 2012 5:12:01 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +ALTER TABLE AD_User ADD COLUMN IsExpired CHAR(1) DEFAULT 'N' CHECK (IsExpired IN ('Y','N')) NOT NULL +; + +-- Sep 10, 2012 5:12:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('SecurityQuestion',200127,'D','Security Question','Security Question','11eefd52-bc27-4768-a8ca-71e4c481fd53',0,TO_TIMESTAMP('2012-09-10 17:12:29','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-09-10 17:12:29','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') +; + +-- Sep 10, 2012 5:12:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200127 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Sep 10, 2012 5:14:35 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,114,200457,'D','N','N','N',0,'N',255,'N',10,'N','N',200127,'N','Y','b92718ad-ac9d-40d7-929a-a1b34d9982fa','N','Y','N','SecurityQuestion','Security Question','Y',100,TO_TIMESTAMP('2012-09-10 17:14:34','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-09-10 17:14:34','YYYY-MM-DD HH24:MI:SS'),100,0,0) +; + +-- Sep 10, 2012 5:14:35 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200457 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Sep 10, 2012 5:14:43 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +ALTER TABLE AD_User ADD COLUMN SecurityQuestion VARCHAR(255) DEFAULT NULL +; + +-- Sep 10, 2012 5:14:58 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('Answer',200128,'D','Answer','Answer','3d07421f-1ebf-49b1-9b0e-d7d4bbb0cc39',0,TO_TIMESTAMP('2012-09-10 17:14:57','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-09-10 17:14:57','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') +; + +-- Sep 10, 2012 5:14:58 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200128 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Sep 10, 2012 5:16:45 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,114,200458,'U','N','N','N',0,'N',1024,'N',10,'N','N',200128,'N','Y','cc25c82a-78b7-4831-81a2-4eae10c6b839','N','Y','N','Answer','Answer','Y',100,TO_TIMESTAMP('2012-09-10 17:16:45','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-09-10 17:16:45','YYYY-MM-DD HH24:MI:SS'),100,0,0) +; + +-- Sep 10, 2012 5:16:45 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200458 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Sep 10, 2012 5:16:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Column SET EntityType='D',Updated=TO_TIMESTAMP('2012-09-10 17:16:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200458 +; + +-- Sep 10, 2012 5:18:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +ALTER TABLE AD_User ADD COLUMN Answer VARCHAR(1024) DEFAULT NULL +; + +-- Sep 10, 2012 5:19:50 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Reset Password',200044,'D','183be9be-6e0a-4cdc-82fd-c91efabfd586','ResetPassword','Y',TO_TIMESTAMP('2012-09-10 17:19:49','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 17:19:49','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:19:51 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200044 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:20:14 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Security Question',200045,'D','74df2198-589e-4e80-93c3-6b300c5705b5','SecurityQuestion','Y',TO_TIMESTAMP('2012-09-10 17:20:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 17:20:13','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:20:14 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200045 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:20:40 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Answer',200046,'D','494db2ce-7749-4f52-82a1-d7e9448ab864','Answer','Y',TO_TIMESTAMP('2012-09-10 17:20:40','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 17:20:40','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:20:46 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Answer',200047,'D','397a2656-2199-4451-87fe-5850b54957c0','Answer','Y',TO_TIMESTAMP('2012-09-10 17:20:45','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 17:20:45','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:21:23 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Security Question is Mandatory',200048,'D','5c73ed0f-6ca9-45bc-8df7-e85f8bc3471d','SecurityQuestionMandatory','Y',TO_TIMESTAMP('2012-09-10 17:21:22','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 17:21:22','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:21:23 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200048 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:21:43 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Answer is Mandatory',200049,'D','2a9de4c5-671b-4622-a8d4-b0fde148308d','AnswerMandatory','Y',TO_TIMESTAMP('2012-09-10 17:21:43','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 17:21:43','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:21:43 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200049 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:22:14 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Invalid Security Question and Answer!',200050,'D','2904015f-ffe7-4179-a76d-5748700ea0ee','InvalidSecurityQuestionAndAnswer','Y',TO_TIMESTAMP('2012-09-10 17:22:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 17:22:13','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 5:22:14 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200050 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 5:22:39 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',118,1024,'N','N',200458,'Y',200473,'N','D','Answer','N','Y','2e16932c-92d6-46a0-be21-70164101b156',100,0,TO_TIMESTAMP('2012-09-10 17:22:38','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2012-09-10 17:22:38','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Sep 10, 2012 5:22:39 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200473 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Sep 10, 2012 5:22:41 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',118,1,'N','N',200456,'Y',200474,'N','D','Expired','N','Y','2b408d81-657b-473b-b425-b97e2d54dd3a',100,0,TO_TIMESTAMP('2012-09-10 17:22:40','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2012-09-10 17:22:40','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Sep 10, 2012 5:22:41 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200474 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Sep 10, 2012 5:22:41 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',118,255,'N','N',200457,'Y',200475,'N','D','Security Question','N','Y','52bbd8a1-d84e-451d-8b79-63a8db9b9dbe',100,0,TO_TIMESTAMP('2012-09-10 17:22:41','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2012-09-10 17:22:41','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Sep 10, 2012 5:22:42 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200475 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Sep 10, 2012 5:22:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=200474 +; + +-- Sep 10, 2012 5:22:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 5:22:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=200473 +; + +-- Sep 10, 2012 5:23:06 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNoGrid=390,IsDisplayedGrid='Y' WHERE AD_Field_ID=200474 +; + +-- Sep 10, 2012 5:23:06 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNoGrid=400,IsDisplayedGrid='Y' WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 5:23:06 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET SeqNoGrid=410,IsDisplayedGrid='Y' WHERE AD_Field_ID=200473 +; + +-- Sep 10, 2012 5:23:47 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2012-09-10 17:23:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200474 +; + +-- Sep 10, 2012 5:23:51 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET IsReadOnly='Y',Updated=TO_TIMESTAMP('2012-09-10 17:23:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 5:24:16 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET IsEncrypted='Y', IsSameLine='Y', IsReadOnly='Y',Updated=TO_TIMESTAMP('2012-09-10 17:24:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200473 +; + +-- Sep 10, 2012 5:24:20 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET IsEncrypted='Y',Updated=TO_TIMESTAMP('2012-09-10 17:24:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 5:24:59 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET DisplayLength=20,Updated=TO_TIMESTAMP('2012-09-10 17:24:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200473 +; + +-- Sep 10, 2012 5:25:02 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET DisplayLength=20,Updated=TO_TIMESTAMP('2012-09-10 17:25:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Sep 10, 2012 6:23:18 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','What was your childhood nickname?',200051,'D','5f1d8902-cf42-4ebc-ac9a-40e08ccdd0e7','SecurityQuestion_1','Y',TO_TIMESTAMP('2012-09-10 18:23:17','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 18:23:17','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:23:19 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200051 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 6:23:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Who was your childhood hero?',200052,'D','a6c718d8-1c4d-423d-a075-724c61d897bd','SecurityQuestion_2','Y',TO_TIMESTAMP('2012-09-10 18:23:29','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 18:23:29','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:23:30 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200052 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 6:23:42 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','What was the name of your elementary / primary school?',200053,'D','f707f3be-69f3-4c3a-870e-5c366e9b2874','SecurityQuestion_3','Y',TO_TIMESTAMP('2012-09-10 18:23:41','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 18:23:41','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:23:42 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200053 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 6:23:52 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','What are the last 5 digits of your driver''s license number?',200054,'D','c1e63df5-2df9-4970-ae78-24b75411d166','SecurityQuestion_4','Y',TO_TIMESTAMP('2012-09-10 18:23:51','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 18:23:51','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:23:52 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200054 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 10, 2012 6:24:04 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Where did you meet your spouse / significant other?',200055,'D','0d1ffdfe-7e55-4796-ba95-7282154fe6fe','SecurityQuestion_5','Y',TO_TIMESTAMP('2012-09-10 18:24:03','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-10 18:24:03','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 10, 2012 6:24:04 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200055 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 11, 2012 2:29:52 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-11 14:29:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200473 +; + +-- Sep 11, 2012 2:29:56 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-11 14:29:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475 +; + +-- Sep 11, 2012 2:31:07 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Field SET XPosition=2, ColumnSpan=2,Updated=TO_TIMESTAMP('2012-09-11 14:31:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200474 +; + +-- Sep 11, 2012 4:08:26 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO R_MailText (MailText,IsHtml,MailHeader,R_MailText_ID,Name,UpdatedBy,AD_Client_ID,Updated,CreatedBy,AD_Org_ID,IsActive,Created,R_MailText_UU) VALUES ('Dear @Name@, + +You are receiving this email because you (or somebody pretending to be you) said you have lost your iDempiere password. + +To access your iDempiere, use the temporary password from @AD_Client_ID@ below: +@Password@ + +Once you login, you will be directed to change password screen. Please change your password to something you can remember. + +Sincerely, +The iDempiere Accounts Team + +Note: This email address cannot accept replies.','N','iDempiere Reset Password ',200000,'Reset Password',100,0,TO_TIMESTAMP('2012-09-11 16:08:24','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2012-09-11 16:08:24','YYYY-MM-DD HH24:MI:SS'),'b8938ab2-d3e8-4cc5-9eae-cf27670d2dae') +; + +-- Sep 11, 2012 4:08:26 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO R_MailText_Trl (AD_Language,R_MailText_ID, MailText,MailHeader,MailText2,MailText3,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,R_MailText_Trl_UU ) SELECT l.AD_Language,t.R_MailText_ID, t.MailText,t.MailHeader,t.MailText2,t.MailText3,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, R_MailText t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.R_MailText_ID=200000 AND NOT EXISTS (SELECT * FROM R_MailText_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.R_MailText_ID=t.R_MailText_ID) +; + +-- Sep 11, 2012 6:26:48 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Change Password',200058,'D','1676e190-c252-42c9-b641-76b52145c35c','ChangePassword','Y',TO_TIMESTAMP('2012-09-11 18:26:46','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-11 18:26:46','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 11, 2012 6:26:48 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200058 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 11, 2012 6:27:32 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Invalid User Name and EMail',200059,'D','cf60c2b0-9d9d-4eed-b04e-496ae2fba7e4','InvalidUserNameAndEmail','Y',TO_TIMESTAMP('2012-09-11 18:27:31','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-11 18:27:31','YYYY-MM-DD HH24:MI:SS')) +; + +-- Sep 11, 2012 6:27:32 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200059 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- Sep 11, 2012 6:27:51 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Message SET MsgText='Invalid User Name and EMail!',Updated=TO_TIMESTAMP('2012-09-11 18:27:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200059 +; + +-- Sep 11, 2012 6:27:51 PM SGT +-- IDEMPIERE-375 Implement Forgot my Password +UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200059 +; + +SELECT register_migration_script('907_IDEMPIERE-375.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_User.java b/org.adempiere.base/src/org/compiere/model/I_AD_User.java index 5e4c6b2164..0a8a6525e9 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_User.java @@ -97,6 +97,15 @@ public interface I_AD_User /** Get AD_User_UU */ public String getAD_User_UU(); + /** Column name Answer */ + public static final String COLUMNNAME_Answer = "Answer"; + + /** Set Answer */ + public void setAnswer (String Answer); + + /** Get Answer */ + public String getAnswer(); + /** Column name Birthday */ public static final String COLUMNNAME_Birthday = "Birthday"; @@ -352,6 +361,15 @@ public interface I_AD_User */ public boolean isActive(); + /** Column name IsExpired */ + public static final String COLUMNNAME_IsExpired = "IsExpired"; + + /** Set Expired */ + public void setIsExpired (boolean IsExpired); + + /** Get Expired */ + public boolean isExpired(); + /** Column name IsFullBPAccess */ public static final String COLUMNNAME_IsFullBPAccess = "IsFullBPAccess"; @@ -535,6 +553,15 @@ public interface I_AD_User */ public String getSalt(); + /** Column name SecurityQuestion */ + public static final String COLUMNNAME_SecurityQuestion = "SecurityQuestion"; + + /** Set Security Question */ + public void setSecurityQuestion (String SecurityQuestion); + + /** Get Security Question */ + public String getSecurityQuestion(); + /** Column name Supervisor_ID */ public static final String COLUMNNAME_Supervisor_ID = "Supervisor_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_User.java b/org.adempiere.base/src/org/compiere/model/X_AD_User.java index 6a3c8df0a7..1add249a9f 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_User.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_User.java @@ -31,7 +31,7 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent /** * */ - private static final long serialVersionUID = 20120830L; + private static final long serialVersionUID = 20120910L; /** Standard Constructor */ public X_AD_User (Properties ctx, int AD_User_ID, String trxName) @@ -42,6 +42,8 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent setAD_User_ID (0); setFailedLoginCount (0); // 0 + setIsExpired (false); +// N setIsFullBPAccess (true); // Y setIsInPayroll (false); @@ -144,6 +146,20 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent return (String)get_Value(COLUMNNAME_AD_User_UU); } + /** Set Answer. + @param Answer Answer */ + public void setAnswer (String Answer) + { + set_Value (COLUMNNAME_Answer, Answer); + } + + /** Get Answer. + @return Answer */ + public String getAnswer () + { + return (String)get_Value(COLUMNNAME_Answer); + } + /** Set Birthday. @param Birthday Birthday or Anniversary day @@ -496,6 +512,27 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent return (String)get_Value(COLUMNNAME_Fax); } + /** Set Expired. + @param IsExpired Expired */ + public void setIsExpired (boolean IsExpired) + { + set_Value (COLUMNNAME_IsExpired, Boolean.valueOf(IsExpired)); + } + + /** Get Expired. + @return Expired */ + public boolean isExpired () + { + Object oo = get_Value(COLUMNNAME_IsExpired); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Full BP Access. @param IsFullBPAccess The user/contact has full access to Business Partner information and resources @@ -803,6 +840,20 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent return (String)get_Value(COLUMNNAME_Salt); } + /** Set Security Question. + @param SecurityQuestion Security Question */ + public void setSecurityQuestion (String SecurityQuestion) + { + set_Value (COLUMNNAME_SecurityQuestion, SecurityQuestion); + } + + /** Get Security Question. + @return Security Question */ + public String getSecurityQuestion () + { + return (String)get_Value(COLUMNNAME_SecurityQuestion); + } + public org.compiere.model.I_AD_User getSupervisor() throws RuntimeException { return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name) diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index 3da04af456..6f72ca7133 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -1412,14 +1412,19 @@ public class Login if (user.isLocked()) continue; - if (MAX_PASSWORD_AGE > 0 && !user.isNoPasswordReset()) + if (user.isExpired()) + isPasswordExpired = true; + else if (MAX_PASSWORD_AGE > 0 && !user.isNoPasswordReset()) { if (user.getDatePasswordChanged() == null) user.setDatePasswordChanged(new Timestamp(now)); long days = (now - user.getDatePasswordChanged().getTime()) / (1000 * 60 * 60 * 24); if (days > MAX_PASSWORD_AGE) + { + user.setIsExpired(true); isPasswordExpired = true; + } } StringBuffer sql= new StringBuffer("SELECT DISTINCT cli.AD_Client_ID, cli.Name, u.AD_User_ID, u.Name"); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java b/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java index 81e899fd54..25aaad2561 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java @@ -63,6 +63,7 @@ import org.compiere.util.KeyNamePair; import org.compiere.util.Language; import org.compiere.util.Login; import org.compiere.util.Msg; +import org.compiere.util.Trx; import org.compiere.util.Util; /** @@ -118,7 +119,10 @@ public final class ALogin extends CDialog private static final int NOT_CONNECTED = -1; private static final int CONNECTED_OK = 0; private static final int CONNECTED_OK_WITH_PASSWORD_EXPIRED = 1; - + +/* private static final int NO_OF_SECURITY_QUESTION = 5; + private static final String SECURITY_QUESTION_PREFIX = "SecurityQuestion_"; +*/ private CPanel mainPanel = new CPanel(new BorderLayout()); private CTabbedPane loginTabPane = new CTabbedPane(); private CPanel connectionPanel = new CPanel(); @@ -163,9 +167,13 @@ public final class ALogin extends CDialog private CLabel lblRetypeNewPassword = new CLabel(); private JPasswordField txtOldPassword = new JPasswordField(); private JPasswordField txtNewPassword = new JPasswordField(); - private JPasswordField txtRetypeNewPassword = new JPasswordField(); + private JPasswordField txtRetypeNewPassword = new JPasswordField(); // - +/* private CLabel lblSecurityQuestion = new CLabel(); + private CLabel lblAnswer = new CLabel(); + private VComboBox lstSecurityQuestion = new VComboBox(); + private CTextField txtAnswer = new CTextField(); +*/ /** Server Connection */ private CConnection m_cc; /** Application User */ @@ -373,7 +381,23 @@ public final class ALogin extends CDialog lblRetypeNewPassword.setLabelFor(txtRetypeNewPassword); lblRetypeNewPassword.setHorizontalAlignment(SwingConstants.RIGHT); lblRetypeNewPassword.setText(Msg.getMsg(m_ctx, "New Password Confirm")); - + +/* lstSecurityQuestion.setName("lstSecurityQuestion"); + lblSecurityQuestion.setRequestFocusEnabled(false); + lblSecurityQuestion.setLabelFor(lstSecurityQuestion); + lblSecurityQuestion.setHorizontalAlignment(SwingConstants.RIGHT); + lblSecurityQuestion.setText(Msg.getMsg(m_ctx, "SecurityQuestion")); + + lstSecurityQuestion.removeAllItems(); + for (int i = 1; i <= NO_OF_SECURITY_QUESTION; i++) + lstSecurityQuestion.addItem(new ValueNamePair(SECURITY_QUESTION_PREFIX + i, Msg.getMsg(m_ctx, SECURITY_QUESTION_PREFIX + i))); + + txtAnswer.setName("txtAnswer"); + lblAnswer.setRequestFocusEnabled(false); + lblAnswer.setLabelFor(txtAnswer); + lblAnswer.setHorizontalAlignment(SwingConstants.RIGHT); + lblAnswer.setText(Msg.getMsg(m_ctx, "Answer")); +*/ changePasswordPanel.setLayout(changePasswordPanelLayout); changePasswordPanel.add(lblOldPassword, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 @@ -388,7 +412,15 @@ public final class ALogin extends CDialog ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0)); changePasswordPanel.add(txtRetypeNewPassword, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0)); - loginTabPane.add(changePasswordPanel, res.getString("ChangePassword")); +/* changePasswordPanel.add(lblSecurityQuestion, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0)); + changePasswordPanel.add(lstSecurityQuestion, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0)); + changePasswordPanel.add(lblAnswer, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0)); + changePasswordPanel.add(txtAnswer, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0)); +*/ loginTabPane.add(changePasswordPanel, res.getString("ChangePassword")); loginTabPane.setEnabledAt(TAB_CHANGE_PASSWORD, false); // @@ -624,6 +656,12 @@ public final class ALogin extends CDialog String newPassword = new String(txtNewPassword.getPassword()); String retypeNewPassword = new String(txtRetypeNewPassword.getPassword()); +/* String securityQuestion = null; + if (lstSecurityQuestion.getSelectedItem() != null) + securityQuestion = ((ValueNamePair) lstSecurityQuestion.getSelectedItem()).getValue(); + + String answer = txtAnswer.getText(); +*/ if (Util.isEmpty(oldPassword)) { statusBar.setStatusLine(Msg.getMsg(m_ctx, "OldPasswordMandatory"), true); @@ -642,6 +680,18 @@ public final class ALogin extends CDialog return; } +/* if (Util.isEmpty(securityQuestion)) + { + statusBar.setStatusLine(Msg.getMsg(m_ctx, "SecurityQuestionMandatory"), true); + return; + } + + if (Util.isEmpty(answer)) + { + statusBar.setStatusLine(Msg.getMsg(m_ctx, "AnswerMandatory"), true); + return; + } +*/ String m_userPassword = new String(m_pwd); if (!oldPassword.equals(m_userPassword)) { @@ -649,21 +699,49 @@ public final class ALogin extends CDialog return; } - for (int index = 0; index < clientCombo.getItemCount(); index++) + Trx trx = null; + try { - KeyNamePair clientKNPair = (KeyNamePair) clientCombo.getItemAt(index); - int clientId = clientKNPair.getKey(); - Env.setContext(m_ctx, "#AD_Client_ID", clientId); - MUser user = MUser.get(m_ctx, m_user); - if (user == null) - { - log.severe("Could not find user '" + m_user + "'"); - statusBar.setStatusLine("Could not find user '" + m_user + "'", true); - return; - } + String trxName = Trx.createTrxName("ChangePasswordTrx"); + trx = Trx.get(trxName, true); - user.setPassword(newPassword); - user.saveEx(); + for (int index = 0; index < clientCombo.getItemCount(); index++) + { + KeyNamePair clientKNPair = (KeyNamePair) clientCombo.getItemAt(index); + int clientId = clientKNPair.getKey(); + Env.setContext(m_ctx, "#AD_Client_ID", clientId); + MUser user = MUser.get(m_ctx, m_user); + if (user == null) + { + trx.rollback(); + log.severe("Could not find user '" + m_user + "'"); + statusBar.setStatusLine("Could not find user '" + m_user + "'", true); + return; + } + + user.setPassword(newPassword); + user.setIsExpired(false); +/* user.setSecurityQuestion(securityQuestion); + user.setAnswer(answer); +*/ if (!user.save(trx.getTrxName())) + { + trx.rollback(); + statusBar.setStatusLine("Could not update user", true); + return; + } + } + + trx.commit(); + } + catch (Exception e) + { + if (trx != null) + trx.rollback(); + } + finally + { + if (trx != null) + trx.close(); } passwordField.setText(newPassword); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 72c7a90ce6..6f7ee8b654 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -90,7 +90,19 @@ public final class AEnv */ public static void showCenterScreen(Window window) { - SessionManager.getAppDesktop().showWindow(window, "center"); + if (SessionManager.getAppDesktop() != null) + SessionManager.getAppDesktop().showWindow(window, "center"); + else + { + window.setPosition("center"); + window.setPage(getDesktop().getFirstPage()); + Object objMode = window.getAttribute(Window.MODE_KEY); + final String mode = objMode != null ? objMode.toString() : Window.MODE_HIGHLIGHTED; + if (Window.MODE_MODAL.equals(mode)) + window.doModal(); + else + window.doHighlighted(); + } } // showCenterScreen /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ChangePasswordPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ChangePasswordPanel.java index 8a8e54a6e0..9e1b9b5a46 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ChangePasswordPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ChangePasswordPanel.java @@ -20,6 +20,7 @@ import java.util.Properties; import org.adempiere.exceptions.AdempiereException; import org.adempiere.webui.AdempiereIdGenerator; import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.Combobox; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Textbox; @@ -33,6 +34,7 @@ import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; +import org.compiere.util.Trx; import org.compiere.util.Util; import org.zkoss.zhtml.Div; import org.zkoss.zhtml.Table; @@ -71,9 +73,13 @@ public class ChangePasswordPanel extends Window implements EventListener private Label lblOldPassword; private Label lblNewPassword; private Label lblRetypeNewPassword; + private Label lblSecurityQuestion; + private Label lblAnswer; + private Combobox lstSecurityQuestion; private Textbox txtOldPassword; private Textbox txtNewPassword; private Textbox txtRetypeNewPassword; + private Textbox txtAnswer; public ChangePasswordPanel(Properties ctx, LoginWindow loginWindow, String userName, String userPassword, boolean show, KeyNamePair[] clientsKNPairs) { @@ -93,7 +99,7 @@ public class ChangePasswordPanel extends Window implements EventListener { Div div = new Div(); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS); - Label label = new Label("Login"); + Label label = new Label(Msg.getMsg(m_ctx, "ChangePassword")); label.setSclass(ITheme.LOGIN_BOX_HEADER_TXT_CLASS); div.appendChild(label); this.appendChild(div); @@ -117,7 +123,7 @@ public class ChangePasswordPanel extends Window implements EventListener td.appendChild(image); tr = new Tr(); - tr.setId("rowUser"); + tr.setId("rowOldPassword"); table.appendChild(tr); td = new Td(); tr.appendChild(td); @@ -151,6 +157,30 @@ public class ChangePasswordPanel extends Window implements EventListener td.setSclass(ITheme.LOGIN_FIELD_CLASS); tr.appendChild(td); td.appendChild(txtRetypeNewPassword); + + tr = new Tr(); + tr.setId("rowSecurityQuestion"); + table.appendChild(tr); + td = new Td(); + tr.appendChild(td); + td.setSclass(ITheme.LOGIN_LABEL_CLASS); + td.appendChild(lblSecurityQuestion); + td = new Td(); + td.setSclass(ITheme.LOGIN_FIELD_CLASS); + tr.appendChild(td); + td.appendChild(lstSecurityQuestion); + + tr = new Tr(); + tr.setId("rowAnswer"); + table.appendChild(tr); + td = new Td(); + tr.appendChild(td); + td.setSclass(ITheme.LOGIN_LABEL_CLASS); + td.appendChild(lblAnswer); + td = new Td(); + td.setSclass(ITheme.LOGIN_FIELD_CLASS); + tr.appendChild(td); + td.appendChild(txtAnswer); div = new Div(); div.setSclass(ITheme.LOGIN_BOX_FOOTER_CLASS); @@ -177,6 +207,25 @@ public class ChangePasswordPanel extends Window implements EventListener lblRetypeNewPassword = new Label(); lblRetypeNewPassword.setId("lblRetypeNewPassword"); lblRetypeNewPassword.setValue(Msg.getMsg(m_ctx, "New Password Confirm")); + + lblSecurityQuestion = new Label(); + lblSecurityQuestion.setId("lblSecurityQuestion"); + lblSecurityQuestion.setValue(Msg.getMsg(m_ctx, "SecurityQuestion")); + + lblAnswer = new Label(); + lblAnswer.setId("lblAnswer"); + lblAnswer.setValue(Msg.getMsg(m_ctx, "Answer")); + + lstSecurityQuestion = new Combobox(); + lstSecurityQuestion.setAutocomplete(true); + lstSecurityQuestion.setAutodrop(true); + lstSecurityQuestion.setId("lstSecurityQuestion"); + lstSecurityQuestion.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + lstSecurityQuestion.getId()); + lstSecurityQuestion.setWidth("220px"); + + lstSecurityQuestion.getItems().clear(); + for (int i = 1; i <= ResetPasswordPanel.NO_OF_SECURITY_QUESTION; i++) + lstSecurityQuestion.appendItem(Msg.getMsg(m_ctx, ResetPasswordPanel.SECURITY_QUESTION_PREFIX + i), ResetPasswordPanel.SECURITY_QUESTION_PREFIX + i); txtOldPassword = new Textbox(); txtOldPassword.setId("txtOldPassword"); @@ -198,6 +247,13 @@ public class ChangePasswordPanel extends Window implements EventListener txtRetypeNewPassword.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + txtNewPassword.getId()); txtRetypeNewPassword.setCols(25); txtRetypeNewPassword.setWidth("220px"); + + txtAnswer = new Textbox(); + txtAnswer.setId("txtAnswer"); +// txtAnswer.setType("password"); + txtAnswer.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + txtAnswer.getId()); + txtAnswer.setCols(25); + txtAnswer.setWidth("220px"); } public void onEvent(Event event) @@ -219,31 +275,70 @@ public class ChangePasswordPanel extends Window implements EventListener String newPassword = txtNewPassword.getValue(); String retypeNewPassword = txtRetypeNewPassword.getValue(); + String securityQuestion = null; + if (lstSecurityQuestion.getSelectedItem() != null) + securityQuestion = (String) lstSecurityQuestion.getSelectedItem().getValue(); + + String answer = txtAnswer.getValue(); + if (Util.isEmpty(oldPassword)) throw new IllegalArgumentException(Msg.getMsg(m_ctx, "OldPasswordMandatory")); if (Util.isEmpty(retypeNewPassword)) throw new IllegalArgumentException(Msg.getMsg(m_ctx, "NewPasswordConfirmMandatory")); - + if (!newPassword.equals(retypeNewPassword)) throw new IllegalArgumentException(Msg.getMsg(m_ctx, "PasswordNotMatch")); - + + if (Util.isEmpty(securityQuestion)) + throw new IllegalArgumentException(Msg.getMsg(m_ctx, "SecurityQuestionMandatory")); + + if (Util.isEmpty(answer)) + throw new IllegalArgumentException(Msg.getMsg(m_ctx, "AnswerMandatory")); + if (!oldPassword.equals(m_userPassword)) throw new IllegalArgumentException(Msg.getMsg(m_ctx, "OldPasswordNoMatch")); - for (KeyNamePair clientKNPair : m_clientKNPairs) + Trx trx = null; + try { - int clientId = clientKNPair.getKey(); - Env.setContext(m_ctx, "#AD_Client_ID", clientId); - MUser user = MUser.get(m_ctx, m_userName); - if (user == null) - { - logger.severe("Could not find user '" + m_userName + "'"); - throw new AdempiereException("Could not find user"); - } + String trxName = Trx.createTrxName("ChangePasswordTrx"); + trx = Trx.get(trxName, true); - user.setPassword(newPassword); - user.saveEx(); + for (KeyNamePair clientKNPair : m_clientKNPairs) + { + int clientId = clientKNPair.getKey(); + Env.setContext(m_ctx, "#AD_Client_ID", clientId); + MUser user = MUser.get(m_ctx, m_userName); + if (user == null) + { + trx.rollback(); + logger.severe("Could not find user '" + m_userName + "'"); + throw new AdempiereException("Could not find user"); + } + + user.setPassword(newPassword); + user.setIsExpired(false); + user.setSecurityQuestion(securityQuestion); + user.setAnswer(answer); + if (!user.save(trx.getTrxName())) + { + trx.rollback(); + throw new AdempiereException("Could not update user"); + } + } + + trx.commit(); + } + catch (Exception e) + { + if (trx != null) + trx.rollback(); + } + finally + { + if (trx != null) + trx.close(); } wndLogin.loginOk(m_userName, m_show, m_clientKNPairs); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index 9a67c2fd63..6ecbfa50db 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -39,6 +39,7 @@ import org.adempiere.webui.component.Combobox; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Textbox; +import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.Window; import org.adempiere.webui.event.TokenEvent; import org.adempiere.webui.exception.ApplicationException; @@ -62,6 +63,7 @@ import org.compiere.util.KeyNamePair; import org.compiere.util.Language; import org.compiere.util.Login; import org.compiere.util.Msg; +import org.compiere.util.Util; import org.zkoss.lang.Strings; import org.zkoss.util.Locales; import org.zkoss.web.Attributes; @@ -112,6 +114,7 @@ public class LoginPanel extends Window implements EventListener private LoginWindow wndLogin; private Checkbox chkRememberMe; private Checkbox chkSelectRole; + private ToolBarButton btnResetPassword; boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); public LoginPanel(Properties ctx, LoginWindow loginWindow) @@ -216,8 +219,20 @@ public class LoginPanel extends Window implements EventListener td.setSclass(ITheme.LOGIN_FIELD_CLASS); tr.appendChild(td); td.appendChild(chkRememberMe); - } + + tr = new Tr(); + tr.setId("rowResetPassword"); + table.appendChild(tr); + td = new Td(); + tr.appendChild(td); + td.setSclass(ITheme.LOGIN_LABEL_CLASS); + td.appendChild(new Label("")); + td = new Td(); + td.setSclass(ITheme.LOGIN_FIELD_CLASS); + tr.appendChild(td); + td.appendChild(btnResetPassword); + btnResetPassword.addEventListener(Events.ON_CLICK, this); div = new Div(); div.setSclass(ITheme.LOGIN_BOX_FOOTER_CLASS); @@ -332,6 +347,8 @@ public class LoginPanel extends Window implements EventListener chkRememberMe = new Checkbox(Msg.getMsg(Language.getBaseAD_Language(), "RememberMe")); chkSelectRole = new Checkbox(Msg.getMsg(Language.getBaseAD_Language(), "SelectRole")); + + btnResetPassword = new ToolBarButton(Msg.getMsg(Language.getBaseAD_Language(), "ResetPassword")); // Make the default language the language of client System String defaultLanguage = MClient.get(ctx, 0).getAD_Language(); @@ -362,6 +379,10 @@ public class LoginPanel extends Window implements EventListener languageChanged(langName); } } + else if (event.getTarget() == btnResetPassword) + { + btnResetPasswordClicked(); + } // Elaine 2009/02/06 - initial language else if (event.getName().equals(Events.ON_CHANGE)) { @@ -435,7 +456,7 @@ public class LoginPanel extends Window implements EventListener lblLanguage.setValue(res.getString("Language")); chkRememberMe.setLabel(Msg.getMsg(language, "RememberMe")); chkSelectRole.setLabel(Msg.getMsg(language, "SelectRole")); - + btnResetPassword.setLabel(Msg.getMsg(language, "ResetPassword")); } private Language findLanguage(String langName) { @@ -545,5 +566,35 @@ public class LoginPanel extends Window implements EventListener String s = "adempiere.store.set(\"zkTimeoutText\", \"" + msg + "\")"; return s; } - + + private void btnResetPasswordClicked() + { + String userId = txtUserId.getValue(); + if (Util.isEmpty(userId)) + throw new IllegalArgumentException(Msg.getMsg(ctx, "FillMandatory") + " " + lblUserId.getValue()); + + boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); + StringBuilder whereClause = new StringBuilder("Password IS NOT NULL AND "); + if (email_login) + whereClause.append("EMail=?"); + else + whereClause.append("COALESCE(LDAPUser,Name)=?"); + whereClause.append(" AND") + .append(" EXISTS (SELECT * FROM AD_User_Roles ur") + .append(" INNER JOIN AD_Role r ON (ur.AD_Role_ID=r.AD_Role_ID)") + .append(" WHERE ur.AD_User_ID=AD_User.AD_User_ID AND ur.IsActive='Y' AND r.IsActive='Y') AND ") + .append(" EXISTS (SELECT * FROM AD_Client c") + .append(" WHERE c.AD_Client_ID=AD_User.AD_Client_ID") + .append(" AND c.IsActive='Y') AND ") + .append(" AD_User.IsActive='Y'") + .append(" AND AD_User.SecurityQuestion IS NOT NULL") + .append(" AND AD_User.Answer IS NOT NULL"); + + List users = new Query(ctx, MUser.Table_Name, whereClause.toString(), null) + .setParameters(userId) + .setOrderBy(MUser.COLUMNNAME_AD_User_ID) + .list(); + + wndLogin.resetPassword(userId, users.size() == 0); + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java new file mode 100644 index 0000000000..8e98d8afe5 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ResetPasswordPanel.java @@ -0,0 +1,430 @@ +/****************************************************************************** + * Copyright (C) 2012 Elaine Tan * + * Copyright (C) 2012 Trek Global + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ + + +package org.adempiere.webui.panel; + +import java.math.BigInteger; +import java.security.SecureRandom; +import java.util.List; +import java.util.Properties; + +import org.adempiere.exceptions.AdempiereException; +import org.adempiere.webui.AdempiereIdGenerator; +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.Combobox; +import org.adempiere.webui.component.ConfirmPanel; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.Textbox; +import org.adempiere.webui.component.Window; +import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.theme.ITheme; +import org.adempiere.webui.theme.ThemeManager; +import org.adempiere.webui.window.LoginWindow; +import org.compiere.model.MClient; +import org.compiere.model.MMailText; +import org.compiere.model.MSysConfig; +import org.compiere.model.MUser; +import org.compiere.model.Query; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.EMail; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Trx; +import org.compiere.util.Util; +import org.zkoss.zhtml.Div; +import org.zkoss.zhtml.Table; +import org.zkoss.zhtml.Td; +import org.zkoss.zhtml.Tr; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zul.Image; + +/** + * Reset Password Panel + * @author Elaine + * @date September 10, 2012 + */ +public class ResetPasswordPanel extends Window implements EventListener +{ + /** + * + */ + private static final long serialVersionUID = 190270426336225224L; + + private static CLogger logger = CLogger.getCLogger(ResetPasswordPanel.class); + + private static final int MAX_RESET_PASSWORD_TRIES = 3; + protected static final int NO_OF_SECURITY_QUESTION = 5; + protected static final String SECURITY_QUESTION_PREFIX = "SecurityQuestion_"; + private static final String RESET_PASSWORD_MAIL_TEXT_NAME = "Reset Password"; + + private LoginWindow wndLogin; + + /** Context */ + private Properties m_ctx; + /** Username */ + private String m_userName; + /** No Security Question */ + private boolean m_noSecurityQuestion; + /** Tries Counter */ + private int counter; + + private Label lblSecurityQuestion; + private Label lblAnswer; + private Label lblUserId; + private Combobox lstSecurityQuestion; + private Textbox txtAnswer; + private Textbox txtUserId; + + public ResetPasswordPanel(Properties ctx, LoginWindow loginWindow, String userName, boolean noSecurityQuestion) + { + this.wndLogin = loginWindow; + m_ctx = ctx; + m_userName = userName; + m_noSecurityQuestion = noSecurityQuestion; + + initComponents(); + init(); + this.setId("resetPasswordPanel"); + } + + private void init() + { + Div div = new Div(); + div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS); + Label label = new Label(Msg.getMsg(m_ctx, "ResetPassword")); + label.setSclass(ITheme.LOGIN_BOX_HEADER_TXT_CLASS); + div.appendChild(label); + this.appendChild(div); + + Table table = new Table(); + table.setId("grdResetPassword"); + table.setDynamicProperty("cellpadding", "0"); + table.setDynamicProperty("cellspacing", "5"); + table.setSclass(ITheme.LOGIN_BOX_BODY_CLASS); + + this.appendChild(table); + + Tr tr = new Tr(); + table.appendChild(tr); + Td td = new Td(); + td.setSclass(ITheme.LOGIN_BOX_HEADER_LOGO_CLASS); + tr.appendChild(td); + td.setDynamicProperty("colspan", "2"); + Image image = new Image(); + image.setSrc(ThemeManager.getLargeLogo()); + td.appendChild(image); + + if (m_noSecurityQuestion) + { + tr = new Tr(); + tr.setId("rowUser"); + table.appendChild(tr); + td = new Td(); + tr.appendChild(td); + td.setSclass(ITheme.LOGIN_LABEL_CLASS); + td.appendChild(lblUserId); + td = new Td(); + td.setSclass(ITheme.LOGIN_FIELD_CLASS); + tr.appendChild(td); + td.appendChild(txtUserId); + } + else + { + tr = new Tr(); + tr.setId("rowSecurityQuestion"); + table.appendChild(tr); + td = new Td(); + tr.appendChild(td); + td.setSclass(ITheme.LOGIN_LABEL_CLASS); + td.appendChild(lblSecurityQuestion); + td = new Td(); + td.setSclass(ITheme.LOGIN_FIELD_CLASS); + tr.appendChild(td); + td.appendChild(lstSecurityQuestion); + + tr = new Tr(); + tr.setId("rowAnswer"); + table.appendChild(tr); + td = new Td(); + tr.appendChild(td); + td.setSclass(ITheme.LOGIN_LABEL_CLASS); + td.appendChild(lblAnswer); + td = new Td(); + td.setSclass(ITheme.LOGIN_FIELD_CLASS); + tr.appendChild(td); + td.appendChild(txtAnswer); + } + + div = new Div(); + div.setSclass(ITheme.LOGIN_BOX_FOOTER_CLASS); + ConfirmPanel pnlButtons = new ConfirmPanel(true); + pnlButtons.addActionListener(this); + LayoutUtils.addSclass(ITheme.LOGIN_BOX_FOOTER_PANEL_CLASS, pnlButtons); + pnlButtons.setWidth(null); + pnlButtons.getButton(ConfirmPanel.A_OK).setSclass(ITheme.LOGIN_BUTTON_CLASS); + pnlButtons.getButton(ConfirmPanel.A_CANCEL).setSclass(ITheme.LOGIN_BUTTON_CLASS); + div.appendChild(pnlButtons); + this.appendChild(div); + } + + private void initComponents() + { + if (m_noSecurityQuestion) + { + boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); + lblUserId = new Label(); + lblUserId.setId("lblUserId"); + lblUserId.setValue(email_login ? Msg.getMsg(m_ctx, "Name") : Msg.getMsg(m_ctx, "EMail")); + + txtUserId = new Textbox(); + txtUserId.setId("txtUserId"); + txtUserId.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + txtUserId.getId()); + txtUserId.setCols(25); + txtUserId.setMaxlength(40); + txtUserId.setWidth("220px"); + } + else + { + lblSecurityQuestion = new Label(); + lblSecurityQuestion.setId("lblSecurityQuestion"); + lblSecurityQuestion.setValue(Msg.getMsg(m_ctx, "SecurityQuestion")); + + lblAnswer = new Label(); + lblAnswer.setId("lblAnswer"); + lblAnswer.setValue(Msg.getMsg(m_ctx, "Answer")); + + lstSecurityQuestion = new Combobox(); + lstSecurityQuestion.setAutocomplete(true); + lstSecurityQuestion.setAutodrop(true); + lstSecurityQuestion.setId("lstSecurityQuestion"); + lstSecurityQuestion.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + lstSecurityQuestion.getId()); + lstSecurityQuestion.setWidth("220px"); + + lstSecurityQuestion.getItems().clear(); + for (int i = 1; i <= NO_OF_SECURITY_QUESTION; i++) + lstSecurityQuestion.appendItem(Msg.getMsg(m_ctx, SECURITY_QUESTION_PREFIX + i), SECURITY_QUESTION_PREFIX + i); + + txtAnswer = new Textbox(); + txtAnswer.setId("txtAnswer"); + // txtAnswer.setType("password"); + txtAnswer.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + txtAnswer.getId()); + txtAnswer.setCols(25); + txtAnswer.setWidth("220px"); + } + } + + public void onEvent(Event event) + { + if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) + { + validateResetPassword(); + } + else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) + { + SessionManager.logoutSession(); + wndLogin.loginCancelled(); + } + } + + public void validateResetPassword() + { + List users = null; + if (m_noSecurityQuestion) + { + String userId = txtUserId.getValue(); + if (Util.isEmpty(userId)) + throw new IllegalArgumentException(Msg.getMsg(m_ctx, "FillMandatory") + " " + lblUserId.getValue()); + + StringBuilder whereClause = new StringBuilder("Password IS NOT NULL "); + boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); + if (email_login) + { + whereClause.append("AND EMail=? "); + whereClause.append("AND COALESCE(LDAPUser,Name)=? "); + } + else + { + whereClause.append("AND COALESCE(LDAPUser,Name)=? "); + whereClause.append("AND EMail=? "); + } + whereClause.append(" AND") + .append(" EXISTS (SELECT * FROM AD_User_Roles ur") + .append(" INNER JOIN AD_Role r ON (ur.AD_Role_ID=r.AD_Role_ID)") + .append(" WHERE ur.AD_User_ID=AD_User.AD_User_ID AND ur.IsActive='Y' AND r.IsActive='Y') AND ") + .append(" EXISTS (SELECT * FROM AD_Client c") + .append(" WHERE c.AD_Client_ID=AD_User.AD_Client_ID") + .append(" AND c.IsActive='Y') AND ") + .append(" AD_User.IsActive='Y'"); + + users = new Query(m_ctx, MUser.Table_Name, whereClause.toString(), null) + .setParameters(m_userName, userId) + .setOrderBy(MUser.COLUMNNAME_AD_User_ID) + .list(); + } + else + { + String securityQuestion = null; + if (lstSecurityQuestion.getSelectedItem() != null) + securityQuestion = (String) lstSecurityQuestion.getSelectedItem().getValue(); + + String answer = txtAnswer.getValue(); + + if (Util.isEmpty(securityQuestion)) + throw new IllegalArgumentException(Msg.getMsg(m_ctx, "SecurityQuestionMandatory")); + + if (Util.isEmpty(answer)) + throw new IllegalArgumentException(Msg.getMsg(m_ctx, "AnswerMandatory")); + + boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); + StringBuilder whereClause = new StringBuilder("Password IS NOT NULL AND "); + if (email_login) + whereClause.append("EMail=?"); + else + whereClause.append("COALESCE(LDAPUser,Name)=?"); + whereClause.append(" AND") + .append(" EXISTS (SELECT * FROM AD_User_Roles ur") + .append(" INNER JOIN AD_Role r ON (ur.AD_Role_ID=r.AD_Role_ID)") + .append(" WHERE ur.AD_User_ID=AD_User.AD_User_ID AND ur.IsActive='Y' AND r.IsActive='Y') AND ") + .append(" EXISTS (SELECT * FROM AD_Client c") + .append(" WHERE c.AD_Client_ID=AD_User.AD_Client_ID") + .append(" AND c.IsActive='Y') AND ") + .append(" AD_User.IsActive='Y'") + .append(" AND AD_User.SecurityQuestion=?") + .append(" AND AD_User.Answer=?"); + + users = new Query(m_ctx, MUser.Table_Name, whereClause.toString(), null) + .setParameters(m_userName, securityQuestion, answer) + .setOrderBy(MUser.COLUMNNAME_AD_User_ID) + .list(); + } + + if (users.size() == 0) + { + String errMsg = m_noSecurityQuestion ? Msg.getMsg(m_ctx, "InvalidUserNameAndEmail") : Msg.getMsg(m_ctx, "InvalidSecurityQuestionAndAnswer"); + ++counter; + + if (counter >= MAX_RESET_PASSWORD_TRIES) + { + counter = 0; + SessionManager.logoutSession(); + wndLogin.loginCancelled(); + } + throw new AdempiereException(errMsg); + } + + boolean hash_password = MSysConfig.getBooleanValue(MSysConfig.USER_PASSWORD_HASH, false); + + StringBuilder sqlUpdate = new StringBuilder("UPDATE AD_User "); + sqlUpdate.append("SET IsExpired='Y', Password=? "); + sqlUpdate.append("WHERE AD_User_ID=? "); + + SecureRandom random = new SecureRandom(); + String newPassword = BigInteger.probablePrime(50, random).toString(Character.MAX_RADIX); + + String errorMsg = ""; + Trx trx = null; + try + { + String trxName = Trx.createTrxName("ResetPasswordTrx"); + trx = Trx.get(trxName, true); + + for (MUser user : users) + { + user.set_TrxName(trx.getTrxName()); + + user.setPassword(newPassword); + if (hash_password) + user.setPassword(user.getPassword()); + // use SQL to update the password to skip password rule validation + int no = DB.executeUpdate(sqlUpdate.toString(), new Object[] {user.getPassword(), user.getAD_User_ID()}, false, trx.getTrxName()); + if (no <= 0) + { + trx.rollback(); + logger.severe("Failed to update user '" + m_userName + "'"); + throw new AdempiereException("Failed to update user"); + } + + if (sendEmail(user, newPassword)) + logger.fine(user.getEMail()); + else + { + if (errorMsg.length() > 0) + errorMsg += ", "; + errorMsg += user.getEMail(); + logger.warning("Failed to send email to user - " + user.getEMail()); + } + } + + trx.commit(); + } + catch (Exception e) + { + if (trx != null) + trx.rollback(); + } + finally + { + if (trx != null) + trx.close(); + } + + if (errorMsg.length() > 0) + throw new AdempiereException(Msg.getMsg(m_ctx, "RequestActionEMailError") + ": " + errorMsg); + else + { + SessionManager.logoutSession(); + wndLogin.loginCancelled(); +// FDialog.info(0, this, Msg.getMsg(m_ctx, "RequestActionEMailOK")); + } + } + + private boolean sendEmail(MUser to, String newPassword) + { + MClient client = MClient.get(m_ctx, to.getAD_Client_ID()); + + StringBuilder sql = new StringBuilder("SELECT R_MailText_ID "); + sql.append("FROM R_MailText "); + sql.append("WHERE IsActive='Y' "); + sql.append("AND Name=? "); + sql.append("AND AD_Client_ID IN (?, 0) "); + sql.append("ORDER BY AD_Client_ID "); + + int R_MailText_ID = DB.getSQLValue(null, sql.toString(), RESET_PASSWORD_MAIL_TEXT_NAME, to.getAD_Client_ID()); + if (R_MailText_ID <= 0) + return false; + + MMailText mailText = new MMailText(m_ctx, R_MailText_ID, null); + to.setPassword(newPassword); + mailText.setUser(to); + String message = mailText.getMailText(true); + message = Env.parseVariable(message, to, to.get_TrxName(), true); + EMail email = client.createEMail(to.getEMail(), mailText.getMailHeader(), message, mailText.isHtml()); + if (mailText.isHtml()) + email.setMessageHTML(mailText.getMailHeader(), message); + else + { + email.setSubject(mailText.getMailHeader()); + email.setMessageText(message); + } + if (!email.isValid() && !email.isValid(true)) + { + logger.warning("NOT VALID - " + email); + return Boolean.FALSE; + } + return EMail.SENT_OK.equals(email.send()); + } +} \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java index 46bd45dbc0..a199ecbb77 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java @@ -30,6 +30,7 @@ import org.adempiere.webui.IWebClient; import org.adempiere.webui.component.FWindow; import org.adempiere.webui.panel.ChangePasswordPanel; import org.adempiere.webui.panel.LoginPanel; +import org.adempiere.webui.panel.ResetPasswordPanel; import org.adempiere.webui.panel.RolePanel; import org.compiere.model.MSysConfig; import org.compiere.model.MUser; @@ -50,7 +51,7 @@ import org.zkoss.zk.ui.event.Events; * @author Sendy Yagambrum * @date July 18, 2007 */ -public class LoginWindow extends FWindow implements EventListener +public class LoginWindow extends FWindow implements EventListener { /** * @@ -60,6 +61,7 @@ public class LoginWindow extends FWindow implements EventListener private IWebClient app; private Properties ctx; private LoginPanel pnlLogin; + private ResetPasswordPanel pnlResetPassword; private ChangePasswordPanel pnlChangePassword; private RolePanel pnlRole; @@ -97,6 +99,13 @@ public class LoginWindow extends FWindow implements EventListener this.getChildren().clear(); this.appendChild(pnlChangePassword); } + + public void resetPassword(String userName, boolean noSecurityQuestion) + { + pnlResetPassword = new ResetPasswordPanel(ctx, this, userName, noSecurityQuestion); + this.getChildren().clear(); + this.appendChild(pnlResetPassword); + } public void loginCompleted() {