|
@@ -40,24 +40,43 @@ public class PageController extends BaseController{
|
|
|
ThirdPartyAuthService thirdPartyAuthService;
|
|
|
|
|
|
@RequestMapping(value = UrlConstants.PAGE + "login", method = RequestMethod.GET)
|
|
|
- public String login(Callback callback, HttpServletRequest request){
|
|
|
- System.out.println(System.currentTimeMillis());
|
|
|
- String afterLogin = null;
|
|
|
- if(callback.getRedirectURL()!=null && callback.getRedirectURL().trim().length()>0){
|
|
|
- if(!callback.getRedirectURL().startsWith("http"))
|
|
|
- callback.setRedirectURL("http://"+callback);
|
|
|
- afterLogin = callback.getRedirectURL();
|
|
|
- }else if (request.getSession().getAttribute("RedirectURL")!=null){
|
|
|
- afterLogin = (String) request.getSession().getAttribute("RedirectURL");
|
|
|
+ public String login(@RequestParam(value = "redirect", required = false)String redirect, HttpServletRequest request){
|
|
|
+// System.out.println(System.currentTimeMillis());
|
|
|
+// String afterLogin = null;
|
|
|
+// if(callback.getRedirectURL()!=null && callback.getRedirectURL().trim().length()>0){
|
|
|
+// if(!callback.getRedirectURL().startsWith("http"))
|
|
|
+// callback.setRedirectURL("http://"+callback);
|
|
|
+// afterLogin = callback.getRedirectURL();
|
|
|
+// }else if (request.getSession().getAttribute("RedirectURL")!=null){
|
|
|
+// afterLogin = (String) request.getSession().getAttribute("RedirectURL");
|
|
|
+// }
|
|
|
+// else if(callback.getDefaultURL()!=null)
|
|
|
+// afterLogin = callback.getDefaultURL();
|
|
|
+// LOG.info("RedirectURL---" + afterLogin);
|
|
|
+// HttpSession session = request.getSession();
|
|
|
+// session.setAttribute("redirectURL", afterLogin);
|
|
|
+// if(session.getAttribute("userId")!=null){
|
|
|
+// LOG.info("用户已登录!用户ID"+session.getAttribute("userId").toString());
|
|
|
+// return "redirect:"+afterLogin;
|
|
|
+// }
|
|
|
+// return "login";
|
|
|
+
|
|
|
+ String redirectUrl = "";
|
|
|
+ try {
|
|
|
+ redirectUrl = EncryptionUtil.decryptDES(redirect);
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.error("redirectUrl 解码出错", e);
|
|
|
+ redirectUrl = null;
|
|
|
+ }
|
|
|
+ if (redirectUrl==null || redirectUrl.isEmpty() || !redirectUrl.startsWith("http")){
|
|
|
+ redirectUrl = UrlConstants.DFAULT_GOTO;
|
|
|
}
|
|
|
- else if(callback.getDefaultURL()!=null)
|
|
|
- afterLogin = callback.getDefaultURL();
|
|
|
- LOG.info("RedirectURL---" + afterLogin);
|
|
|
HttpSession session = request.getSession();
|
|
|
- session.setAttribute("redirectURL", afterLogin);
|
|
|
- if(session.getAttribute("userId")!=null){
|
|
|
+ session.setAttribute("RedirectUrl", redirectUrl);
|
|
|
+ LOG.info("RedirectUrl" + redirectUrl);
|
|
|
+ if (session.getAttribute("userId") != null){
|
|
|
LOG.info("用户已登录!用户ID"+session.getAttribute("userId").toString());
|
|
|
- return "redirect:"+afterLogin;
|
|
|
+ return "redirect:"+redirectUrl;
|
|
|
}
|
|
|
return "login";
|
|
|
}
|