} else if (!okPassword) {
return PASSWORD;
}
// Create or acquire our User instance
User user = null;
if (state.isCreating()) {
user = logic.createUser();
} else {
user = (User) getBean(getUserKey());
}
// Update to reflect changes during this dialog
user.setCategories(state.getCategories());
if (state.isCreating()) {
user.setConfirmed(!isConfirmation());
}
user.setEmailAddress(state.getEmailAddress());
user.setFullName(state.getFullName());
if ((state.getPassword() != null) && (state.getPassword().length() > 0)) {
user.setPassword(state.getPassword());
}
user.setUsername(state.getUsername());
// Persist the changes made during this dialog
if (state.isCreating()) {
logic.insertUser(user);
} else {
logic.updateUser(user);
}
// Log in a new user if already confirmed
// Otherwise, send the confirmation email
if (state.isCreating()) {
if (user.isConfirmed()) {
getSessionMap().put(getUserKey(),user);
} else {
info(messages.getMessage("profile.confirm"));
// FIXME - send confirmation email
}