}
private void changePasswordActionMenuItem_actionPerformed(
java.awt.event.ActionEvent evt) {
SystemDBController systemController = SystemDBController.getInstance();
ChangePasswordDialog passwordDialog = new ChangePasswordDialog(this, "Change password");
Map passwordMap = null;
Map userMap = null;
int tries = 0;
try {
while (true) {
passwordMap = passwordDialog.showDialog();
if (((Boolean) passwordMap.get("isOkPressed")).equals(Boolean.FALSE)) {
return;
}
if (!passwordMap.get("password1").equals(passwordMap.get("password2"))) {
Messager.information(this, "Passwords are not equal");
continue;
}
if (passwordMap.get("password1").toString().length() < 6) {
Messager.information(this, "Passwords must have 6 or more characters");
continue;
}
if (tries++ >3) {
continue; // Do not check anymore
}
userMap = systemController.getUser(LoginController.getPerson().get("user_name").toString());
if (!userMap.get("Password").equals(passwordMap.get("passwordOld"))) {
continue;
}
systemController.alterUser(LoginController.getPerson().get("user_name").toString(), passwordMap.get("password1").toString());
return;
}
} catch (ControllerException ce) {
Messager.exception(this, ce.getMessage());
return;