user.setFullName(getDisplayName());
user.setEmail(getEmail());
}
public boolean save(UserHandler userHandler, WebuiRequestContext context) throws Exception {
UIApplication uiApp = context.getUIApplication();
String pass = getPassword();
String confirm_pass = getUIStringInput(CONFIRM_PASSWORD).getValue();
if (!pass.equals(confirm_pass)) {
uiApp.addMessage(new ApplicationMessage("UIAccountForm.msg.password-is-not-match", null));
return false;
}
String username = getUserName();
// Check if user name already existed
if (userHandler.findUserByName(username) != null) {
Object[] args = { username };
uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.user-exist", args));
return false;
}
// Check if mail address is already used
Query query = new Query();
query.setEmail(getEmail());
if (userHandler.findUsers(query).getAll().size() > 0) {
Object[] args = { username };
uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.email-exist", args));
return false;
}
User user = userHandler.createUserInstance(username);
bindingFields(user);