checkPassword(password, confirmPassword, response);
if (token == null || "".equals(token)) {
response.addErrorCode("invalidToken");
}
ForgotPasswordSecurityToken fpst = null;
if (! response.getHasErrors()) {
token = token.toLowerCase();
fpst = forgotPasswordSecurityTokenDao.readToken(passwordEncoder.encodePassword(token, null));
if (fpst == null) {
response.addErrorCode("invalidToken");
} else if (fpst.isTokenUsedFlag()) {
response.addErrorCode("tokenUsed");
} else if (isTokenExpired(fpst)) {
response.addErrorCode("tokenExpired");
}
}
if (! response.getHasErrors()) {
user.setUnencodedPassword(password);
saveAdminUser(user);
fpst.setTokenUsedFlag(true);
forgotPasswordSecurityTokenDao.saveToken(fpst);
}
return response;
}