Peer review from a suggested patch from Hiep Lq -> IDEMPIERE-3408 Encrypted Field can explore by normal user

This commit is contained in:
Carlos Ruiz 2017-06-24 13:34:10 +02:00
parent 462f0e799f
commit 10be967c75
3 changed files with 19 additions and 2 deletions

View File

@ -89,6 +89,8 @@ public class Obscure extends Object
public static final String OBSCURETYPE_ObscureAlphaNumericButFirstLast4 = "A44";
/** Obscure AlphaNumeric but last 4 = A04 */
public static final String OBSCURETYPE_ObscureAlphaNumericButLast4 = "A04";
/** Obscure by asterisk character, use for EncryptedField */
public static final String OBSCURETYPE_ObscureAllAsterisk = "AA";
/** Obscure Type */
private String m_type = OBSCURETYPE_ObscureDigitsButLast4;
@ -103,7 +105,8 @@ public class Obscure extends Object
*/
public void setType (String obscureType)
{
if (obscureType == null || obscureType.equals("904") || obscureType.equals("944") || obscureType.equals("A44") || obscureType.equals("A04"))
if (obscureType == null || obscureType.equals("904") || obscureType.equals("944") || obscureType.equals("A44") || obscureType.equals("A04") ||
OBSCURETYPE_ObscureAllAsterisk.equals(obscureType))
{
m_type = obscureType;
m_obscuredValue = null;
@ -161,6 +164,11 @@ public class Obscure extends Object
return m_obscuredValue;
if (m_clearValue == null || m_clearValue.length() == 0)
return m_clearValue;
if (OBSCURETYPE_ObscureAllAsterisk.equals(m_type)){
return "**********";
}
//
boolean alpha = m_type.charAt(0) == 'A';
int clearStart = Integer.parseInt(m_type.substring(1,2));

View File

@ -34,7 +34,7 @@ public class Textbox extends org.zkoss.zul.Textbox implements EventListener<Even
/**
*
*/
private static final long serialVersionUID = 2201466028538929955L;
private static final long serialVersionUID = -3919623360765045602L;
private Obscure m_obscure = null;
@ -118,4 +118,12 @@ public class Textbox extends org.zkoss.zul.Textbox implements EventListener<Even
setValue(getValue());
}
}
@Override
public void setType(String type) throws WrongValueException {
if ("password".equals(type))
setObscureType(Obscure.OBSCURETYPE_ObscureAllAsterisk);
super.setType(type);
}
}

View File

@ -258,6 +258,7 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
txtSecurityQuestion.setVisible(false);
txtAnswer = new Textbox();
txtAnswer.setType("password");
txtAnswer.setId("txtAnswer");
// txtAnswer.setType("password");
txtAnswer.setCols(25);