struts-sandbox/struts2/apps/mailreader-wildone/src/main/java/mailreader2/registration/Update.java [17:44]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public String execute()
            throws Exception {

        boolean creating = Constants.CREATE.equals(getTask());
        creating = creating && isCreating(); // trust but verify
        if (creating) {
            addActionError("registration/Update: ");
            addActionError(Constants.ERROR_INVALID_WORKFLOW);            
            return ERROR;
        }
        // FIXME: Any way to call the Update validators from here?
        String newPassword = fixNull(getPassword());
        String confirmPassword = fixNull(getPassword2());
        if (newPassword != null) {
            boolean matches = ((confirmPassword != null)
                    && (confirmPassword.equals(newPassword)));
            if (matches) {
                getUser().setPassword(newPassword);
            } else {
                addActionError(getText("error.password.match"));
                return INPUT;
            }
        }

        saveUser();

        return SUCCESS;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



struts-sandbox/struts2/apps/mailreader-ibatis/src/main/java/mailreader2/registration/Update.java [20:47]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public String execute()
            throws Exception {

        boolean creating = Constants.CREATE.equals(getTask());
        creating = creating && isCreating(); // trust but verify
        if (creating) {
            addActionError("registration/Update: ");
            addActionError(Constants.ERROR_INVALID_WORKFLOW);            
            return ERROR;
        }
        // FIXME: Any way to call the RegisrationSave validators from here?
        String newPassword = fixNull(getPassword());
        String confirmPassword = fixNull(getPassword2());
        if (newPassword != null) {
            boolean matches = ((confirmPassword != null)
                    && (confirmPassword.equals(newPassword)));
            if (matches) {
                getUser().setPassword(newPassword);
            } else {
                addActionError(getText("error.password.match"));
                return INPUT;
            }
        }

        saveUser();

        return SUCCESS;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



