我安装了补丁SUPEE 6788,密码重置表格不再有效。我找到了this question,通过更改customer.xml,我可以恢复重置功能。问题是:如果用户输入了错误的密码(即密码的最小长度必须为6,但用户只输入4个字母),则没有错误消息。有一个
private static final int TAB_WIDTH = 5;
public static void main(String[] args)
{
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("Stackoverflow");
shell.setLayout(new FillLayout());
StyledText text = new StyledText(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
text.setTabs(TAB_WIDTH);
text.setText("");
text.setLeftMargin(5);
text.setBounds(0, 0, 512, 391);
text.addListener(SWT.KeyUp, (e) -> {
if (e.stateMask == SWT.CTRL && e.keyCode == 'u')
{
int currentLine = text.getLineAtOffset(text.getCaretOffset());
String textAtLine = text.getLine(currentLine);
int spaces = getLeadingSpaces(textAtLine);
text.insert("\n");
text.setCaretOffset(text.getCaretOffset() + 1);
for (int i = 0; i < spaces; i++)
text.append(" ");
text.setCaretOffset(text.getCaretOffset() + spaces);
}
});
shell.pack();
shell.open();
shell.setSize(400, 300);
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
private static int getLeadingSpaces(String line)
{
int counter = 0;
char[] chars = line.toCharArray();
for (char c : chars)
{
if (c == '\t')
counter += TAB_WIDTH;
else if (c == ' ')
counter++;
else
break;
}
return counter;
}
在表单标记之前,但它仍然没有显示错误消息。奇怪的是,如果我之后导航到登录表单,那里将显示应该在resetform上显示的错误消息。
任何人都有解决方案吗?