Merge pull request #1771 from eyison/master

解决 "https" redirect之后跳转 "http" 问题
master
许雪里 4 years ago committed by GitHub
commit 7698044d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java
  2. 4
      xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/PermissionInterceptor.java

@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -51,11 +53,12 @@ public class IndexController {
@RequestMapping("/toLogin")
@PermissionLimit(limit=false)
public String toLogin(HttpServletRequest request, HttpServletResponse response) {
public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response,ModelAndView modelAndView) {
if (loginService.ifLogin(request, response) != null) {
return "redirect:/";
modelAndView.setView(new RedirectView("/",true,false));
return modelAndView;
}
return "login";
return new ModelAndView("login");
}
@RequestMapping(value="login", method=RequestMethod.POST)

@ -43,8 +43,8 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
if (needLogin) {
XxlJobUser loginUser = loginService.ifLogin(request, response);
if (loginUser == null) {
response.sendRedirect(request.getContextPath() + "/toLogin");
//request.getRequestDispatcher("/toLogin").forward(request, response);
response.setStatus(302);
response.setHeader("location", request.getContextPath()+"/toLogin");
return false;
}
if (needAdminuser && loginUser.getRole()!=1) {

Loading…
Cancel
Save