Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String updateAccount() {
- if (statusMessage == null || statusMessage.isEmpty()) {
- // Obtain the signed-in user's username
- String user_name = (String) FacesContext.getCurrentInstance().
- getExternalContext().getSessionMap().get("username");
- // Obtain the object reference of the signed-in user
- Responder editResponder = getResponderFacade().findByUsername(user_name);
- try {
- /*
- Set the signed-in user's properties to the values entered by
- the user in the EditAccountProfileForm in EditAccount.xhtml.
- */
- editResponder.setResponderName(this.selected.getResponderName());
- // editResponder.setAddress1(this.selected.getAddress1());
- // editResponder.setAddress2(this.selected.getAddress2());
- editResponder.setLocationId(this.selected.getLocationId());
- editResponder.setLocationId(this.selected.getLocationId());
- editResponder.setEmail(this.selected.getEmail());
- // It is optional for the user to change his/her password
- String new_Password = getNewPassword();
- if (new_Password == null || new_Password.isEmpty()) {
- // Do nothing. The user does not want to change the password.
- } else {
- editResponder.setPassword(new_Password);
- // Password changed successfully!
- // Password was first validated by invoking the validatePasswordChange method below.
- }
- // Store the changes in the CloudDriveDB database
- getResponderFacade().edit(editResponder);
- } catch (EJBException e) {
- username = "";
- statusMessage = "Something went wrong while editing user's profile! See: " + e.getMessage();
- return "";
- }
- // Account update is completed, redirect to show the Profile page.
- return "Profile.xhtml?faces-redirect=true";
- }
- return "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement