Commit 62834704 authored by xc's avatar xc

登录提示回传优化

parent fe6258ae
package cn.wisenergy.service.shir.filter;
import cn.wisenergy.common.utils.exception.Result;
import com.alibaba.fastjson.JSONObject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.springframework.http.HttpStatus;
......@@ -8,8 +9,6 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
/**
* 继承FormAuthenticationFilter登录认证
......@@ -25,10 +24,11 @@ public class AuthenticationFilter extends FormAuthenticationFilter {
setHeader(httpRequest, httpResponse);
httpResponse.setCharacterEncoding("UTF-8");
httpResponse.setContentType("application/json");
Map<String, Object> map = new HashMap<>();
map.put("status", "1001");
map.put("message", "未登录,马上去登录!");
httpResponse.getWriter().write(JSONObject.toJSONString(map));
Result result = new Result();
result.setResult(Result.RESULT_FLG.FAIL.getValue());
result.setErrorCode("1001");
result.setErrorMsg("请先登录后再执行操作");
httpResponse.getWriter().write(JSONObject.toJSONString(result));
return false;
} else {
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment