xydata-tools 1.1.31 → 1.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/xyAuthLayout/index.js +20 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -227,6 +227,7 @@ var removeSessionData = function removeSessionData() {
|
|
|
227
227
|
removeSessionStorage('Token');
|
|
228
228
|
removeSessionStorage('sso_redirect_url');
|
|
229
229
|
};
|
|
230
|
+
var aaaLoginUrl = null;
|
|
230
231
|
|
|
231
232
|
// ========== 组件定义 ==========
|
|
232
233
|
|
|
@@ -244,6 +245,7 @@ var XyAuthLayout = function XyAuthLayout(props) {
|
|
|
244
245
|
var loginType = envData.login_type || 'BOTH';
|
|
245
246
|
var pathName = window.location.pathname;
|
|
246
247
|
var loginId = getQueryVariable('loginId');
|
|
248
|
+
aaaLoginUrl = envData.parent_login_url || "".concat(window.publicPath || '/', "user/login");
|
|
247
249
|
useEffect(function () {
|
|
248
250
|
if (!token && !(loginId && ['BOTH', 'AAA'].includes(loginType))) {
|
|
249
251
|
// 当登录方式为SSO_NEW或BOTH时,可在路径加上sso进行统一登陆,当登录方式固定为SSO或SSO_NEW时,直接跳转到SSO登录
|
|
@@ -252,7 +254,7 @@ var XyAuthLayout = function XyAuthLayout(props) {
|
|
|
252
254
|
envData.sso_type === 'new' ? ssoTypeByNew() : ssoTypeByOld();
|
|
253
255
|
} else {
|
|
254
256
|
// 其他情况跳转到AAA登录
|
|
255
|
-
window.location.href =
|
|
257
|
+
window.location.href = aaaLoginUrl;
|
|
256
258
|
}
|
|
257
259
|
} else {
|
|
258
260
|
// 当有TOKEN或者AAA登录并携带loginId时可进入
|
|
@@ -370,30 +372,30 @@ export var logout = /*#__PURE__*/function () {
|
|
|
370
372
|
// 当 loginType 为 BOTH 时,根据 sessionStorage 中的 'sso_redirect_url' 判断实际登录方式
|
|
371
373
|
// 有 'sso_redirect_url' 说明使用的是 SSO 登录,否则是 AAA 登录
|
|
372
374
|
actualLoginType = loginType;
|
|
375
|
+
redirectUrl = getSessionStorage('sso_redirect_url');
|
|
373
376
|
if (loginType === 'BOTH') {
|
|
374
|
-
redirectUrl = getSessionStorage('sso_redirect_url');
|
|
375
377
|
actualLoginType = redirectUrl ? 'SSO' : 'AAA';
|
|
376
378
|
}
|
|
377
379
|
if (!(actualLoginType === 'AAA')) {
|
|
378
|
-
_context5.next =
|
|
380
|
+
_context5.next = 17;
|
|
379
381
|
break;
|
|
380
382
|
}
|
|
381
|
-
_context5.prev =
|
|
382
|
-
_context5.next =
|
|
383
|
+
_context5.prev = 5;
|
|
384
|
+
_context5.next = 8;
|
|
383
385
|
return accountAAALogout({});
|
|
384
|
-
case
|
|
386
|
+
case 8:
|
|
385
387
|
removeSessionData();
|
|
386
|
-
_context5.next =
|
|
388
|
+
_context5.next = 14;
|
|
387
389
|
break;
|
|
388
|
-
case
|
|
389
|
-
_context5.prev =
|
|
390
|
-
_context5.t0 = _context5["catch"](
|
|
390
|
+
case 11:
|
|
391
|
+
_context5.prev = 11;
|
|
392
|
+
_context5.t0 = _context5["catch"](5);
|
|
391
393
|
console.error('AAA 退出登录失败:', _context5.t0);
|
|
392
|
-
case
|
|
393
|
-
window.location.href =
|
|
394
|
-
_context5.next =
|
|
394
|
+
case 14:
|
|
395
|
+
window.location.href = aaaLoginUrl;
|
|
396
|
+
_context5.next = 18;
|
|
395
397
|
break;
|
|
396
|
-
case
|
|
398
|
+
case 17:
|
|
397
399
|
try {
|
|
398
400
|
fetch('/auth/logout', {
|
|
399
401
|
headers: getCommonHeaders()
|
|
@@ -405,15 +407,14 @@ export var logout = /*#__PURE__*/function () {
|
|
|
405
407
|
removeSessionData();
|
|
406
408
|
} catch (e) {
|
|
407
409
|
console.error('SSO 退出登录失败:', e);
|
|
408
|
-
// 即使退出失败,也清理本地数据并跳转到登录页
|
|
409
410
|
removeSessionData();
|
|
410
|
-
window.location.href =
|
|
411
|
+
window.location.href = redirectUrl;
|
|
411
412
|
}
|
|
412
|
-
case
|
|
413
|
+
case 18:
|
|
413
414
|
case "end":
|
|
414
415
|
return _context5.stop();
|
|
415
416
|
}
|
|
416
|
-
}, _callee5, null, [[
|
|
417
|
+
}, _callee5, null, [[5, 11]]);
|
|
417
418
|
}));
|
|
418
419
|
return function logout() {
|
|
419
420
|
return _ref5.apply(this, arguments);
|
|
@@ -450,7 +451,7 @@ export var handleUnauthorized = function handleUnauthorized(envData) {
|
|
|
450
451
|
return;
|
|
451
452
|
}
|
|
452
453
|
// AAA 登录过期,跳转到 AAA 登录页面
|
|
453
|
-
window.location.href =
|
|
454
|
+
window.location.href = aaaLoginUrl;
|
|
454
455
|
} else {
|
|
455
456
|
// SSO 登录过期,重新进行 SSO 登录流程
|
|
456
457
|
setSessionStorage('sso_redirect_url', window.location.href);
|