From b8f54de8f986e6b573acbfeff18ed766b51cf277 Mon Sep 17 00:00:00 2001 From: trifonnt Date: Mon, 22 Feb 2010 12:14:39 +0000 Subject: [PATCH] BF [2956546] - Login from WEB should also use LDAPUser https://sourceforge.net/tracker/?func=detail&aid=2956546&group_id=176962&atid=879332 --- base/src/org/compiere/model/MUser.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/base/src/org/compiere/model/MUser.java b/base/src/org/compiere/model/MUser.java index 28a66d28c9..66ced53720 100644 --- a/base/src/org/compiere/model/MUser.java +++ b/base/src/org/compiere/model/MUser.java @@ -171,10 +171,12 @@ public class MUser extends X_AD_User int AD_Client_ID = Env.getAD_Client_ID(ctx); MUser retValue = null; - /* TODO: Implement same validation as in Login.java - - * about (SELECT IsEncrypted FROM AD_Column WHERE AD_Column_ID=417)='N') */ String sql = "SELECT * FROM AD_User " - + "WHERE Name=? AND (Password=? OR Password=?) AND IsActive='Y' AND AD_Client_ID=?"; + + "WHERE COALESCE(LDAPUser, Name)=? " // #1 + + " AND ((Password=? AND (SELECT IsEncrypted FROM AD_Column WHERE AD_Column_ID=417)='N') " // #2 + + "OR (Password=? AND (SELECT IsEncrypted FROM AD_Column WHERE AD_Column_ID=417)='Y'))" // #3 + + " AND IsActive='Y' AND AD_Client_ID=?" // #4 + ; PreparedStatement pstmt = null; ResultSet rs = null; try @@ -182,7 +184,7 @@ public class MUser extends X_AD_User pstmt = DB.prepareStatement (sql, null); pstmt.setString (1, name); pstmt.setString (2, password); - pstmt.setString(3, SecureEngine.encrypt(password)); + pstmt.setString (3, SecureEngine.encrypt(password)); pstmt.setInt(4, AD_Client_ID); rs = pstmt.executeQuery (); if (rs.next ())