public void onClick(ClickEvent event) { if (EditProfileLayout.this.form.validate(false)) { UserRole userRole = null; if (ClientSessionManager.isAdminLogin()) { userRole = UserRole.ADMIN; } else if (ClientSessionManager.isUserLogin()) { userRole = UserRole.USER; } String password = DataControlsSes.createMD5(EditProfileLayout.this.form.getValueAsString("oldPassword")); UserDTO u = new UserDTO(Integer.parseInt(getLoggedInUserId()), EditProfileLayout.this.form.getValueAsString("userName"), EditProfileLayout.this.form.getValueAsString("name"), password, EditProfileLayout.this.form.getValueAsString("email"), userRole, new Date()); u.setActivated(true); if (EditProfileLayout.this.newPasswordItem.getValue() != null) { u.setNewPassword(DataControlsSes.createMD5(EditProfileLayout.this.newPasswordItem.getValueAsString())); } EventBus.getMainEventBus().fireEvent(new UpdateUserEvent(currentSession(), u)); } } });
protected void register() { form.validate(true); if (RegisterLayout.this.form.validate() && (Boolean) RegisterLayout.this.acceptBox.getValue()) { String userName = (String) RegisterLayout.this.userNameItem.getValue(); String name = (String) RegisterLayout.this.nameItem.getValue(); String password = DataControlsSes.createMD5((String) RegisterLayout.this.passwordItem.getValue()); String eMail = (String) RegisterLayout.this.emailItem.getValue(); boolean activated = false; if (name == null || name.equals("")) { name = ""; } // create user without parameterId and register UserDTO u = new UserDTO(userName, name, password, eMail, NOT_REGISTERED_USER, activated, new Date()); EventBus.getMainEventBus().fireEvent(new RegisterUserEvent(u)); } else if (RegisterLayout.this.form.validate() && !(Boolean) RegisterLayout.this.acceptBox.getValue()) { SC.say(i18n.acceptTermsOfUseInfo()); } }