alertSuperPasswordLabelLabel.setText(TxtManager.getTxt("VALIDATE.PASSWORDERROR"));
alertSuperPasswordLabelLabel.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertSuperPasswordLabelLabel.setVisible(true);
} else {
String oldPassword = null;
SealedObject so = (SealedObject)value;
try {
oldPassword = PasswordManager.getPassword(so);
} catch (Exception e) {
e.printStackTrace();
}
StringBuffer sb = new StringBuffer(TxtManager.getTxt("INFORMATION.SHOWPASSWORD"));
sb.append(oldPassword + " !");
DialogManager.showMessageDialog(this, sb.toString());
}
}
}
} else if (n == 0) {
if (createNewPassword) {
if (newPasswordField1.getPassword().length == 0) {
alertNewPasswordLabel1.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertNewPasswordLabel1.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel1.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel1.setVisible(false);
}
if (newPasswordField2.getPassword().length == 0) {
alertNewPasswordLabel2.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertNewPasswordLabel2.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel2.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel2.setVisible(false);
}
if (n!= -1) {
String newPassword1 = new String(newPasswordField1.getPassword());
String newPassword2 = new String(newPasswordField2.getPassword());
if (!newPassword1.equals(newPassword2)) {
alertNewPasswordLabel2.setText(TxtManager.getTxt("VALIDATE.PASSWORDNOTEQUAL"));
alertNewPasswordLabel2.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel2.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel2.setVisible(false);
}
}
} else {
if (superUserPasswordField.getPassword().length == 0) {
String oldPassword = null;
SealedObject so = (SealedObject)value;
try {
oldPassword = PasswordManager.getPassword(so);
} catch (Exception e) {
e.printStackTrace();
}
if (oldPasswordField.getPassword().length == 0) {
alertOldPasswordLabel.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertOldPasswordLabel.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertOldPasswordLabel.setVisible(true);
n=-1;
} else {
String oldPassword1 = new String(oldPasswordField.getPassword());
if (!oldPassword.equals(oldPassword1)) {
alertOldPasswordLabel.setText(TxtManager.getTxt("VALIDATE.PASSWORDERROR"));
alertOldPasswordLabel.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertOldPasswordLabel.setVisible(true);
n=-1;
} else {
alertOldPasswordLabel.setVisible(false);
}
}
if (newPasswordField1.getPassword().length == 0) {
alertNewPasswordLabel1.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertNewPasswordLabel1.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel1.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel1.setVisible(false);
}
if (newPasswordField2.getPassword().length == 0) {
alertNewPasswordLabel2.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertNewPasswordLabel2.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel2.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel2.setVisible(false);
}
if (n != -1) {
String newPassword1 = new String(newPasswordField1.getPassword());
String newPassword2 = new String(newPasswordField2.getPassword());
if (!newPassword1.equals(newPassword2)) {
alertNewPasswordLabel2.setText(TxtManager.getTxt("VALIDATE.PASSWORDNOTEQUAL"));
alertNewPasswordLabel2.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel2.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel2.setVisible(false);
}
}
} else {
alertOldPasswordLabel.setVisible(false);
if (newPasswordField1.getPassword().length == 0) {
alertNewPasswordLabel1.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertNewPasswordLabel1.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel1.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel1.setVisible(false);
}
if (newPasswordField2.getPassword().length == 0) {
alertNewPasswordLabel2.setText(TxtManager.getTxt("VALIDATE.NULLVALUE"));
alertNewPasswordLabel2.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel2.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel2.setVisible(false);
}
if (n != -1) {
String newPassword1 = new String(newPasswordField1.getPassword());
String newPassword2 = new String(newPasswordField2.getPassword());
if (!newPassword1.equals(newPassword2)) {
alertNewPasswordLabel2.setText(TxtManager.getTxt("VALIDATE.PASSWORDNOTEQUAL"));
alertNewPasswordLabel2.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertNewPasswordLabel2.setVisible(true);
n = -1;
} else {
alertNewPasswordLabel2.setVisible(false);
}
}
if (n != -1) {
String superUserPassword1 = new String(superUserPasswordField.getPassword());
String superUserPassword = UserClass.getSuperUserPassword();
if (!superUserPassword.equals(superUserPassword1)) {
alertSuperPasswordLabelLabel.setText(TxtManager.getTxt("VALIDATE.PASSWORDERROR"));
alertSuperPasswordLabelLabel.setIcon(ImageManager.getImage(ImageManager.ALERT_IMAGE));
alertSuperPasswordLabelLabel.setVisible(true);
n=-1;
} else {
alertSuperPasswordLabelLabel.setVisible(false);
}
}
}
}
}
}
if (n == 0) {
try {
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.ENCRYPT_MODE, GlobalValueManager.getPasswordKey());
String password = new String(newPasswordField1.getPassword());
SealedObject so = new SealedObject(password, cipher);
setValue(so);
} catch (Exception e) {
e.printStackTrace();
}
}