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.MSystem;
import org.compiere.model.MUser;
import org.compiere.model.PO;
import org.compiere.model.Query;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -686,12 +687,18 @@ public class LoginPanel extends Window implements EventListener<Event>
.append(" AD_User.IsActive='Y'")
.append(" AND AD_User.SecurityQuestion IS NOT NULL")
.append(" AND AD_User.Answer IS NOT NULL");
List<MUser> users = new Query(ctx, MUser.Table_Name, whereClause.toString(), null)
.setParameters(userId)
.setOrderBy(MUser.COLUMNNAME_AD_User_ID)
.list();
List<MUser> users;
try {
PO.setCrossTenantSafe();
users = new Query(ctx, MUser.Table_Name, whereClause.toString(), null)
.setParameters(userId)
.setOrderBy(MUser.COLUMNNAME_AD_User_ID)
.list();
} finally {
PO.clearCrossTenantSafe();
}
wndLogin.resetPassword(userId, users.size() == 0);
}