-
- MessageDialog.openInformation(link.getShell(),
- "Not implemented", "Implement This.");
-
- // ChangePasswordDialog dialog = new ChangePasswordDialog(
- // link.getShell(), userDetailsManager);
- // if (dialog.open() == Window.OK) {
- // MessageDialog.openInformation(HandlerUtil.getActiveShell(event),
- // "Password changed", "Password changed.");
- // }
- // return null;
+ String msg = null;
+ if ("".equals(pwd1.getText().trim()))
+ msg = "Passwords cannot be blank";
+ else if (!pwd1.getText().equals(pwd2.getText()))
+ msg = "Passwords do not match, please try again.";
+
+ if (msg != null) {
+ MessageDialog.openError(link.getShell(), "Error", msg);
+ } else {
+ try {
+ String username = getNode().getProperty(
+ ArgeoNames.ARGEO_USER_ID).getString();
+ if (userAdminService.userExists(username)) {
+ JcrUserDetails userDetails = (JcrUserDetails) userAdminService
+ .loadUserByUsername(username);
+ userDetails = userDetails.cloneWithNewPassword(pwd1
+ .getText());
+ userAdminService.updateUser(userDetails);
+ MessageDialog.openInformation(link.getShell(),
+ "Password changed", "Password changed.");
+ }
+ } catch (Exception re) {
+ throw new ArgeoException(
+ "unable to reset password for user "
+ + getNode(), re);
+ }
+ }
+
+ pwd1.setText("");
+ pwd2.setText("");