}
private WebErrors validateSubmit(String username, String email,
String password, String captcha, CmsSite site,
HttpServletRequest request, HttpServletResponse response) {
MemberConfig mcfg = site.getConfig().getMemberConfig();
WebErrors errors = WebErrors.create(request);
try {
if (!imageCaptchaService.validateResponseForID(session
.getSessionId(request, response), captcha)) {
errors.addErrorCode("error.invalidCaptcha");
return errors;
}
} catch (CaptchaServiceException e) {
errors.addErrorCode("error.exceptionCaptcha");
log.warn("", e);
return errors;
}
if (errors.ifOutOfLength(username, "username",
mcfg.getUsernameMinLen(), 100)) {
return errors;
}
if (errors.ifNotUsername(username, "username",
mcfg.getUsernameMinLen(), 100)) {
return errors;
}
if (errors.ifOutOfLength(password, "password",
mcfg.getPasswordMinLen(), 100)) {
return errors;
}
if (errors.ifMaxLength(email, "email", 100)) {
return errors;
}
// 保留字检查不通过,返回false。
if (!mcfg.checkUsernameReserved(username)) {
errors.addErrorCode("error.usernameReserved");
return errors;
}
// 用户名存在,返回false。
if (unifiedUserMng.usernameExist(username)) {