}
@Override
- public void doChangePersonalData () throws UserPasswordMismatchException {
+ public String doChangePersonalData () throws UserPasswordMismatchException {
// This method shall only be called if the user is logged-in
if (!this.loginController.isUserLoggedIn()) {
// Not logged-in
throw new IllegalStateException("User is not logged-in"); //NOI18N
+ } else if (!this.isRequiredPersonalDataSet()) {
+ // Not all required fields are set
+ throw new FaceletException("Not all required fields are set."); //NOI18N
} else if (!this.loginController.ifCurrentPasswordMatches()) {
// Password not matching
throw new UserPasswordMismatchException(this.loginController.getLoggedInUser());
}
+
+ // Create new user instance from existing data
+ User user = this.createUserInstance();
+
+ // Update it from logged-in user (e.g. user and contact id)
+ user.setUserId(this.loginController.getLoggedInUser().getUserId());
+ user.getUserContact().setContactId(this.loginController.getLoggedInUser().getUserContact().getContactId());
+
+ // Send it to the EJB
+ this.userBean.updateUserPersonalData(user);
+
+ // All fine
+ return "login_personal_data_changed"; //NOI18N
}
@Override
* Changes logged-in user's personal data if the current password matches
* and TAC + privacy statement has been accepted.
* <p>
+ * @return New target page
+ * <p>
* @throws UserPasswordMismatchException If the entered password doesn't match
*/
- void doChangePersonalData () throws UserPasswordMismatchException;
+ String doChangePersonalData () throws UserPasswordMismatchException;
}