提交 35629acc 编写于 作者: jlj05024111@163.com's avatar jlj05024111@163.com

feat: 更新无权限时的重新登录逻辑

上级 58f71936
......@@ -25,32 +25,7 @@ export class UnauthorizedHandler {
if (!ibiz.env.casLoginUrl) {
throw new RuntimeError('找不到环境参数casLoginUrl');
}
const { origin } = window.location;
const baseUrl = `${origin}${ibiz.env.baseUrl}`;
// 登录后返回来的登录的地址
const backUrl = `${baseUrl}/cas/v7/login${qs.stringify(
{
RU: UrlHelper.fullPath,
base: baseUrl,
},
{ addQueryPrefix: true },
)}`;
// 要跳转的cas的登录页和参数
const hasQueryPrefix = ibiz.env.casLoginUrl.indexOf('?') !== -1;
const targetUrl =
ibiz.env.casLoginUrl +
(hasQueryPrefix ? '&' : '?') +
qs.stringify(
{
service: backUrl,
},
{ addQueryPrefix: false },
);
// 跳转cas登录地址
safeRedirect(targetUrl, { type: 'href' });
safeRedirect(ibiz.env.casLoginUrl, { type: 'href' });
}
/**
......@@ -63,10 +38,6 @@ export class UnauthorizedHandler {
* @returns {*} {Promise<void>}
*/
protected static async normalLogin(): Promise<void> {
if (ibiz.env.noAuthRedirectUrl) {
safeRedirect(ibiz.env.noAuthRedirectUrl, { type: '_self' });
return;
}
// 禁止跳转登录视图时不处理
if (!ibiz.env.disabledLogin) {
const ru = window.location.hash.replace('#', '');
......
......@@ -36,9 +36,6 @@ const router = new Router({
path: '/login',
name: 'loginView',
beforeEnter: async (_to, _from, next) => {
if (ibiz.env.noAuthRedirectUrl) {
safeRedirect(ibiz.env.noAuthRedirectUrl, { type: '_self' });
}
if (ibiz.env.disabledLogin) {
next(false);
} else {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册