From 4123d471748e86be5db0cccf2cc7de42a217f432 Mon Sep 17 00:00:00 2001 From: DacongDA Date: Wed, 6 Mar 2024 01:07:52 +0800 Subject: [PATCH] feat: callback will jump to blank page when from param start with "http" (#2778) --- web/src/Setting.js | 9 +++++++++ web/src/auth/AuthCallback.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/web/src/Setting.js b/web/src/Setting.js index 18dbd778..462c5c81 100644 --- a/web/src/Setting.js +++ b/web/src/Setting.js @@ -707,6 +707,15 @@ export function goToLinkSoft(ths, link) { ths.props.history.push(link); } +export function goToLinkSoftOrJumpSelf(ths, link) { + if (link.startsWith("http")) { + goToLink(link); + return; + } + + ths.props.history.push(link); +} + export function showMessage(type, text) { if (type === "success") { message.success(text); diff --git a/web/src/auth/AuthCallback.js b/web/src/auth/AuthCallback.js index d72d9e7a..2f5a98f6 100644 --- a/web/src/auth/AuthCallback.js +++ b/web/src/auth/AuthCallback.js @@ -172,7 +172,7 @@ class AuthCallback extends React.Component { Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}${responseType}=${token}&state=${oAuthParams.state}&token_type=bearer`); } else if (responseType === "link") { const from = innerParams.get("from"); - Setting.goToLinkSoft(this, from); + Setting.goToLinkSoftOrJumpSelf(this, from); } else if (responseType === "saml") { if (res.data2.method === "POST") { this.setState({