...
|
...
|
@@ -6,6 +6,7 @@ import com.ui.User.UserAuthLocal; |
|
|
import com.ui.contants.HttpUriContants;
|
|
|
import com.ui.http.HttpRestClient;
|
|
|
import com.ui.model.BaseResponse;
|
|
|
import com.ui.model.Directional;
|
|
|
import com.ui.model.req.AuthModule;
|
|
|
import com.ui.model.req.User;
|
|
|
import org.apache.commons.lang.RandomStringUtils;
|
...
|
...
|
@@ -18,9 +19,13 @@ import org.springframework.stereotype.Controller; |
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
...
|
...
|
@@ -32,7 +37,10 @@ public class UserCtrl { |
|
|
Logger log = LoggerFactory.getLogger(UserCtrl.class);
|
|
|
|
|
|
@Autowired
|
|
|
HttpRestClient httpRestClient;
|
|
|
private RestTemplate restTemplate;
|
|
|
|
|
|
@Autowired
|
|
|
private HttpRestClient httpRestClient;
|
|
|
|
|
|
@Autowired
|
|
|
UserAuthLocal userAuthLocal;
|
...
|
...
|
@@ -48,7 +56,7 @@ public class UserCtrl { |
|
|
}
|
|
|
|
|
|
@RequestMapping("/login")
|
|
|
public ModelAndView toLogin(User user, HttpSession session, Model model) {
|
|
|
public ModelAndView toLogin(User user, HttpSession session, Model model, HttpServletResponse response) {
|
|
|
if (StringUtils.isBlank(user.getName())){
|
|
|
if (session.getAttribute("user") == null){
|
|
|
return new ModelAndView("user/login");
|
...
|
...
|
@@ -65,7 +73,17 @@ public class UserCtrl { |
|
|
}
|
|
|
if (u.getPwd().equals(MD5Util.encryption(user.getPwd()))) {
|
|
|
session.setAttribute("user", u);
|
|
|
return new ModelAndView("dashBoard/dashBoard");
|
|
|
if(StringUtils.isBlank(Directional.getInstance().getLoginTargetUrl())){
|
|
|
return new ModelAndView("dashBoard/dashBoard");
|
|
|
}else{
|
|
|
try {
|
|
|
//直接跳转到初始的请求页面
|
|
|
response.sendRedirect(Directional.getInstance().getLoginTargetUrl());
|
|
|
} catch (IOException e) {
|
|
|
return new ModelAndView("dashBoard/dashBoard");
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
} else {
|
|
|
model.addAttribute("message", "密码错误");
|
|
|
return new ModelAndView("user/login");
|
...
|
...
|
|