@Override
public User loginByForm(HttpServletRequest request,
HttpServletResponse response, User user) throws UserException {
if (StringUtils.isBlank(user.getNicknameOrEmail())) {
throw new UserException("�û��������䲻��Ϊ��");
}
if (StringUtils.isBlank(user.getPassword())) {
throw new UserException("�û��������벻��Ϊ��");
}
String securityPassword = SecurityUtils
.sha1(Constants.PASSWORD_PUBLIC_KEY + "-" + user.getPassword());
logger.debug("user.getNicknameOrEmail():[" + user.getNicknameOrEmail()
+ "] user.getNickname():[" + user.getNickname()
+ "] user.getEmail():[" + user.getEmail()
+ "] securityPassword:[" + securityPassword
+ "] securityPassword.length():[" + securityPassword.length()
+ "]");
if (StringUtils.isNotBlank(user.getNickname())) {
user = userDao.findUniqueByParams(new String[] { "status",
"nickname", "password" }, new Object[] { 1,
user.getNickname(), securityPassword });
} else {
user = userDao.findUniqueByParams(new String[] { "status", "email",
"password" }, new Object[] { 1, user.getEmail(),
securityPassword });
}
if (user == null) {
throw new UserException("�û�������");
}
CookieManager.setCookie(Constants.COOKIE_UID, user.getId().toString(),
-1, "/", "mamaeye.com", false, request, response);
CookieManager.setCookie(Constants.COOKIE_NICKNAME, user.getNickname(),