Commit 84844ac5 by fengshuonan

修复权限异常会登录超时的问题

parent edbbd56e
...@@ -24,7 +24,9 @@ public enum AuthExceptionEnum implements AbstractBaseExceptionEnum { ...@@ -24,7 +24,9 @@ public enum AuthExceptionEnum implements AbstractBaseExceptionEnum {
VALID_CODE_ERROR(1406, "验证码错误"), VALID_CODE_ERROR(1406, "验证码错误"),
NO_PERMISSION(1500, "没有权限访问资源"); NO_PERMISSION(1500, "没有权限访问资源"),
SESSION_TIMEOUT(1501, "登录会话超时");
AuthExceptionEnum(int code, String message) { AuthExceptionEnum(int code, String message) {
this.code = code; this.code = code;
......
...@@ -99,6 +99,7 @@ public class JwtAuthorizationTokenFilter extends OncePerRequestFilter { ...@@ -99,6 +99,7 @@ public class JwtAuthorizationTokenFilter extends OncePerRequestFilter {
} }
//跳转到登录超时 //跳转到登录超时
response.setHeader("Guns-Session-Timeout", "true");
request.getRequestDispatcher("/global/sessionError").forward(request, response); request.getRequestDispatcher("/global/sessionError").forward(request, response);
return; return;
......
...@@ -15,10 +15,6 @@ ...@@ -15,10 +15,6 @@
*/ */
package cn.stylefeng.guns.sys.core.constant; package cn.stylefeng.guns.sys.core.constant;
import cn.hutool.core.collection.CollectionUtil;
import java.util.List;
/** /**
* 系统常量 * 系统常量
* *
...@@ -42,19 +38,4 @@ public interface Const { ...@@ -42,19 +38,4 @@ public interface Const {
*/ */
Long ADMIN_ROLE_ID = 1L; Long ADMIN_ROLE_ID = 1L;
/**
* 不需要权限验证的资源表达式
*/
List<String> NONE_PERMISSION_RES = CollectionUtil.newLinkedList(
"/assets/**",
"/gunsApi/**",
"/login",
"/global/sessionError",
"/kaptcha",
"/error",
"/global/error",
"/oauth/**",
"/tran/**",
"/favicon.ico");
} }
...@@ -141,7 +141,7 @@ layui.config({ ...@@ -141,7 +141,7 @@ layui.config({
complete: function (XMLHttpRequest, textStatus) { complete: function (XMLHttpRequest, textStatus) {
//如果超时就处理 ,指定要跳转的页面 //如果超时就处理 ,指定要跳转的页面
if (XMLHttpRequest.responseJSON.code === 1500) { if (XMLHttpRequest.getResponseHeader("Guns-Session-Timeout") === "true") {
window.location = Feng.ctxPath + "/global/sessionError"; window.location = Feng.ctxPath + "/global/sessionError";
} }
......
...@@ -143,7 +143,7 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'ax', 'func', ...@@ -143,7 +143,7 @@ layui.use(['layer', 'form', 'table', 'ztree', 'laydate', 'admin', 'ax', 'func',
var ajax = new $ax(Feng.ctxPath + "/mgr/reset", function (data) { var ajax = new $ax(Feng.ctxPath + "/mgr/reset", function (data) {
Feng.success("重置密码成功!"); Feng.success("重置密码成功!");
}, function (data) { }, function (data) {
Feng.error("重置密码失败!"); Feng.error("重置密码失败!" + data.responseJSON.message + "!");
}); });
ajax.set("userId", data.userId); ajax.set("userId", data.userId);
ajax.start(); ajax.start();
......
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