IDEMPIERE-5378 MFA must allow to select the mechanism when the user has several registered (FHCA-3808) (#1434)

* IDEMPIERE-5378 MFA must allow to select the mechanism when the user has several registered (FHCA-3808)

* IDEMPIERE-5378 auto select when TOTP is the only mechanism
This commit is contained in:
Carlos Ruiz 2022-08-12 11:30:54 +02:00 committed by GitHub
parent 5e5c977733
commit 9bfc177697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -26,6 +26,7 @@
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
@ -260,15 +261,12 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
lstMFAMechanism.setAutocomplete(true); lstMFAMechanism.setAutocomplete(true);
lstMFAMechanism.setAutodrop(true); lstMFAMechanism.setAutodrop(true);
lstMFAMechanism.setId("lstMFAMechanism"); lstMFAMechanism.setId("lstMFAMechanism");
boolean first = true; List<MMFARegistration> regs = MMFARegistration.getValidRegistrationsFromUser();
for (MMFARegistration reg : MMFARegistration.getValidRegistrationsFromUser()) { for (MMFARegistration reg : regs) {
MMFAMethod method = new MMFAMethod(m_ctx, reg.getMFA_Method_ID(), reg.get_TrxName()); MMFAMethod method = new MMFAMethod(m_ctx, reg.getMFA_Method_ID(), reg.get_TrxName());
if (first) { if (regs.size() == 1 && MMFAMethod.METHOD_Time_BasedOne_TimePassword.equals(method.getMethod())) {
first = false;
if (MMFAMethod.METHOD_Time_BasedOne_TimePassword.equals(method.getMethod())) {
m_autoCall = true; m_autoCall = true;
} }
}
ComboItem ci = new ComboItem(reg.getName() + " - " + method.getMethod(), reg.getMFA_Registration_ID()); ComboItem ci = new ComboItem(reg.getName() + " - " + method.getMethod(), reg.getMFA_Registration_ID());
String id = AdempiereIdGenerator.escapeId(ci.getLabel()); String id = AdempiereIdGenerator.escapeId(ci.getLabel());
if (lstMFAMechanism.getFellowIfAny(id) == null) if (lstMFAMechanism.getFellowIfAny(id) == null)