WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
UIApplication uiApp = context.getUIApplication();
String pass1x = getUIStringInput(PASSWORD1X).getValue();
String pass2x = getUIStringInput(PASSWORD2X).getValue();
if (!pass1x.equals(pass2x)) {
uiApp.addMessage(new ApplicationMessage("UIAccountForm.msg.password-is-not-match", null, ApplicationMessage.ERROR));
return false;
}
String username = getUIStringInput(USERNAME).getValue();
if (newUser) {
User user = service.getUserHandler().createUserInstance(username);
invokeSetBindingField(user);
// user.setPassword(Util.encodeMD5(pass1x)) ;
if (service.getUserHandler().findUserByName(user.getUserName()) != null) {
Object[] args = { user.getUserName() };
uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.user-exist", args, ApplicationMessage.ERROR));
return false;
}
Query query = new Query();
query.setEmail(getUIStringInput("email").getValue());
if (service.getUserHandler().findUsers(query).getAll().size() > 0) {
Object[] args = { user.getUserName() };
uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.email-exist", args, ApplicationMessage.ERROR));
return false;
}
service.getUserHandler().createUser(user, true);
reset();