IDEMPIERE-4844 Cross tenant issue on Forgot My Password (#737)

This commit is contained in:
Carlos Ruiz 2021-06-23 05:14:21 +02:00 committed by GitHub
parent 9ad3f5ce46
commit 594c7bb437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 6 deletions

View File

@ -56,6 +56,7 @@ import org.compiere.model.MSession;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.MSystem; import org.compiere.model.MSystem;
import org.compiere.model.MUser; import org.compiere.model.MUser;
import org.compiere.model.PO;
import org.compiere.model.Query; import org.compiere.model.Query;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -687,10 +688,16 @@ public class LoginPanel extends Window implements EventListener<Event>
.append(" AND AD_User.SecurityQuestion IS NOT NULL") .append(" AND AD_User.SecurityQuestion IS NOT NULL")
.append(" AND AD_User.Answer IS NOT NULL"); .append(" AND AD_User.Answer IS NOT NULL");
List<MUser> users = new Query(ctx, MUser.Table_Name, whereClause.toString(), null) List<MUser> users;
try {
PO.setCrossTenantSafe();
users = new Query(ctx, MUser.Table_Name, whereClause.toString(), null)
.setParameters(userId) .setParameters(userId)
.setOrderBy(MUser.COLUMNNAME_AD_User_ID) .setOrderBy(MUser.COLUMNNAME_AD_User_ID)
.list(); .list();
} finally {
PO.clearCrossTenantSafe();
}
wndLogin.resetPassword(userId, users.size() == 0); wndLogin.resetPassword(userId, users.size() == 0);
} }