Browse Source

用户登录拦截验证更新

hejq 7 years ago
parent
commit
5de16a4d60

+ 1 - 1
src/main/java/com/uas/platform/b2b/filter/SSOInterceptor.java

@@ -189,7 +189,7 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
      * @param authorized 验证是否通过
      */
     protected void setResponseAuthorized(HttpServletResponse response, User user, boolean authorized) {
-        if (null == user) {
+        if (!authorized) {
             // 再次校验是否还存在用户信息
             user = SystemSession.getUser();
         }

+ 3 - 10
src/main/webapp/resources/js/index/app.js

@@ -12,17 +12,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
     app.factory('httpInterceptor', ['$window', '$q', function ($window, $q) {
         var httpInterceptor = {
             'responseError': function (response) {
-                var authorized = false;
-                var headers = response.headers();
-                angular.forEach(headers, function(header) {
-                    if (header.authorized == 'OK') {
-                        authorized = true;
-                    }
-                })
-                if (response.status == 401 && !authorized) {// UNAUTHORIZED
+                if (response.status == 401) {// UNAUTHORIZED
                     // window.location.href = response.data.loginUrl || 'index';
-                    // window.location.href = window.location.origin + window.location.pathname + '/login';
-                    window.location.reload();
+                    window.location.href = window.location.origin + window.location.pathname + '/login';
+                    // window.location.reload();
                     return $q.reject(response);
                 }
                 return $q.reject(response);