From cdf2d1ef07f68496a2a95b7e8718b423c000f952 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Thu, 13 Sep 2012 17:59:14 +0800 Subject: [PATCH] IDEMPIERE-375 Implement Forgot my Password - fix the query to load security question --- .../org/adempiere/webui/panel/ResetPasswordPanel.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 index bfb591318d..6b089d1d70 100644 --- 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 @@ -265,15 +265,20 @@ public class ResetPasswordPanel extends Window implements EventListener if (Util.isEmpty(email)) throw new IllegalArgumentException(Msg.getMsg(m_ctx, "FillMandatory") + " " + lblEmail.getValue()); - // Assume user with same email uses the same password and security question + // TODO: Validation for user with same email uses the same password and security question StringBuilder sql = new StringBuilder("SELECT SecurityQuestion "); sql.append("FROM AD_User "); sql.append("WHERE IsActive='Y' "); + boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); + if (email_login) + sql.append("AND EMail=? "); + else + sql.append("AND COALESCE(LDAPUser,Name)=? "); sql.append("AND EMail=? "); - sql.append("AND SecurityQuestion IS NOT NULL "); + sql.append("AND SecurityQuestion IS NOT NULL "); sql.append("ORDER BY AD_Client_ID DESC"); - String securityQuestion = DB.getSQLValueString(null, sql.toString(), email); + String securityQuestion = DB.getSQLValueString(null, sql.toString(), m_userName, email); txtSecurityQuestion.setValue(securityQuestion); txtEmail.setReadonly(true);