|
|
@@ -4,6 +4,7 @@ import com.uas.credit.dao.UserDao;
|
|
|
import com.uas.credit.model.User;
|
|
|
import com.uas.credit.util.ContextUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -26,16 +27,19 @@ public class AuthorizeInterceptor extends HandlerInterceptorAdapter {
|
|
|
String userUUString = request.getParameter("userUU");
|
|
|
String enUUString = request.getParameter("enUU");
|
|
|
String password = request.getParameter("password");
|
|
|
+ ModelMap modelMap = new ModelMap();
|
|
|
+ modelMap.put("success", "false");
|
|
|
+ PrintWriter writer = response.getWriter();
|
|
|
// 判断 userUUString、enUUString、passwordString 是否为数字
|
|
|
if (!StringUtils.isNumeric(userUUString) || !StringUtils.isNumeric(enUUString)) {
|
|
|
- PrintWriter writer = response.getWriter();
|
|
|
- writer.print("userUU 和 enUU 只能为数字 ");
|
|
|
+ modelMap.put("message", "userUU 和 enUU 只能为数字");
|
|
|
+ writer.print(modelMap);
|
|
|
writer.flush();
|
|
|
return false;
|
|
|
}
|
|
|
if (password == null) {
|
|
|
- PrintWriter writer = response.getWriter();
|
|
|
- writer.print("password 不能为空");
|
|
|
+ modelMap.put("message", "password 不能为空");
|
|
|
+ writer.print(modelMap);
|
|
|
writer.flush();
|
|
|
return false;
|
|
|
}
|
|
|
@@ -43,8 +47,8 @@ public class AuthorizeInterceptor extends HandlerInterceptorAdapter {
|
|
|
long enUU = Long.parseLong(enUUString);
|
|
|
User user = userDao.findByUserUUAndEnUUAndPassword(userUU, enUU, password);
|
|
|
if (user == null) {
|
|
|
- PrintWriter writer = response.getWriter();
|
|
|
- writer.print("用户不存在!");
|
|
|
+ modelMap.put("message", "用户不存在!");
|
|
|
+ writer.print(modelMap);
|
|
|
writer.flush();
|
|
|
return false;
|
|
|
}
|