public String doRegister() { if (!StringUtils.validateName(getName())) { setErrMsg(StringUtils.NAME_FORMAT_WARN_MSG); return ERROR; } if (!StringUtils.validateAccount(getAccount())) { setErrMsg(StringUtils.ACCOUNT_FORMAT_WARN_MSG); return ERROR; } User user = new User(); user.setAccount(getAccount()); user.setPassword(getPassword()); user.setName(getName()); user.setEmail(getEmail()); String validateMsg = getAccountMgr().validatePasswordFormat(getPassword()); if (validateMsg != null) { setErrMsg(validateMsg); return ERROR; } if (getAccountMgr().getUserId(user.getAccount()) > 0) { setErrMsg("该用户名" + user.getAccount() + "已经存在咯~~~"); return ERROR; } else if (super.getAccountMgr().addUser(user)) { return doLogin(); } else { return ERROR; } }
public String doUpdateProfile() { if (!isUserLogined()) { plsLogin(); setRelativeReturnUrl("/account/updateProfile.do"); return LOGIN; } if (!StringUtils.validateName(getName())) { setIsEditMode(true); setErrMsg(StringUtils.NAME_FORMAT_WARN_MSG); return SUCCESS; } if (getNewPassword() != null && !getNewPassword().isEmpty()) { String validateMsg = getAccountMgr().validatePasswordFormat(getNewPassword()); if (validateMsg != null) { setIsEditMode(true); setErrMsg(validateMsg); return SUCCESS; } } if (!super.getAccountMgr() .updateProfile(getCurUserId(), getName(), getEmail(), getPassword(), getNewPassword())) { setIsEditMode(true); setErrMsg("旧密码输入错误"); } else { setIsOpSuccess(true); } return SUCCESS; }
public String toString(TO_STRING_TYPE type) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("{\"createDateStr\":\"" + getCreateDateStr() + "\","); stringBuilder.append("\"user\":" + getUser() + ","); stringBuilder.append("\"id\":" + getId() + ","); stringBuilder.append("\"version\":\"" + getVersion() + "\","); stringBuilder.append("\"introduction\":\"" + StringUtils.escapeInJ(getIntroduction()) + "\","); stringBuilder.append("\"name\":\"" + StringUtils.escapeInJ(getName()) + "\","); stringBuilder.append("\"moduleList\":"); stringBuilder.append("["); Iterator<Module> iterator = getModuleListOrdered().iterator(); while (iterator.hasNext()) { stringBuilder.append(iterator.next().toString(type)); if (iterator.hasNext()) { stringBuilder.append(","); } } stringBuilder.append("]}"); return stringBuilder.toString(); }