new LoginFrame();
}
}
private SealedObject showSuperPasswordDialog() {
SealedObject password = null;
JPanel panel = new JPanel();
CellConstraints cc = new CellConstraints();
panel.setLayout(new FormLayout(
new ColumnSpec[] {
new ColumnSpec("10px"),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
new ColumnSpec("150px"),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
new ColumnSpec("100px"),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
new ColumnSpec("150px")
},
new RowSpec[] {
new RowSpec("10px"),
FormFactory.LINE_GAP_ROWSPEC,
new RowSpec("20px"),
FormFactory.LINE_GAP_ROWSPEC,
new RowSpec("20px"),
}));
JLabel superUserPasswordLabel1 = new JLabel();
superUserPasswordLabel1.setText(TxtManager.getTxt("VIEW.PASSWORDEDIT.SUPERUSERPASSWORDLABEL"));
panel.add(superUserPasswordLabel1, cc.xy(3, 3));
JPasswordField superUserPasswordField1 = new JPasswordField();
panel.add(superUserPasswordField1, cc.xy(5, 3));
JLabel alertSuperPasswordLabelLabel1 = new JLabel();
alertSuperPasswordLabelLabel1.setVisible(false);
panel.add(alertSuperPasswordLabelLabel1, cc.xy(7, 3));
JLabel superUserPasswordLabel2 = new JLabel();
superUserPasswordLabel2.setText(TxtManager.getTxt("VIEW.PASSWORDEDIT.NEWPASSWORDLABEL2"));
panel.add(superUserPasswordLabel2, cc.xy(3, 5));
JPasswordField superUserPasswordField2 = new JPasswordField();
panel.add(superUserPasswordField2, cc.xy(5, 5));
JLabel alertSuperUserPasswordLabel2 = new JLabel();
alertSuperUserPasswordLabel2.setVisible(false);
panel.add(alertSuperUserPasswordLabel2, cc.xy(7, 5));
Object[] options = {TxtManager.getTxt("VIEW.GLOBAL.CONFIRMBUTTON"),
TxtManager.getTxt("VIEW.GLOBAL.CANCELBUTTON")};
int n = -1;
while ( (n != 0) && (n != 1) ) {
n = JOptionPane.showOptionDialog(this, panel, TxtManager.getTxt("INFORMATION.CREATESUPERUSERPASSWORD"),
JOptionPane.OK_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
if (n == 0) {
if (superUserPasswordField1.getPassword().length == 0) {
alertSuperPasswordLabelLabel1.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertSuperPasswordLabelLabel1.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertSuperPasswordLabelLabel1.setVisible(true);
n = -1;
} else {
alertSuperPasswordLabelLabel1.setVisible(false);
}
if (superUserPasswordField2.getPassword().length == 0) {
alertSuperUserPasswordLabel2.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertSuperUserPasswordLabel2.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertSuperUserPasswordLabel2.setVisible(true);
n = -1;
} else {
alertSuperUserPasswordLabel2.setVisible(false);
}
if (n!= -1) {
String newPassword1 = new String(superUserPasswordField1.getPassword());
String newPassword2 = new String(superUserPasswordField2.getPassword());
if (!newPassword1.equals(newPassword2)) {
alertSuperUserPasswordLabel2.setText(TxtManager.getTxt("VALIDATE.PASSWORDNOTEQUAL"));
alertSuperUserPasswordLabel2.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertSuperUserPasswordLabel2.setVisible(true);
n = -1;
} else {
alertSuperUserPasswordLabel2.setVisible(false);
}
}
}
}
if (n == 0) {
try {
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.ENCRYPT_MODE, GlobalValueManager.getPasswordKey());
String passwordString = new String(superUserPasswordField1.getPassword());
password = new SealedObject(passwordString, cipher);
} catch (Exception e) {
e.printStackTrace();
}
}
return password;