提交 8662dcea 作者: yueyang.lv

fix: minio login 页关闭

上级 fe0c1fba
...@@ -41,7 +41,8 @@ import MainError from "../Console/Common/MainError/MainError"; ...@@ -41,7 +41,8 @@ import MainError from "../Console/Common/MainError/MainError";
import { encodeFileName } from "../../common/utils"; import { encodeFileName } from "../../common/utils";
import { LockIcon, LoginMinIOLogo, UsersIcon } from "../../icons"; import { LockIcon, LoginMinIOLogo, UsersIcon } from "../../icons";
import { spacingUtils } from "../Console/Common/FormComponents/common/styleLibrary"; import { spacingUtils } from "../Console/Common/FormComponents/common/styleLibrary";
import message from '../../utils/message'; import message from "../../utils/message";
import { toLoginPage } from "../../utils/toLogin";
const styles = (theme: Theme) => const styles = (theme: Theme) =>
createStyles({ createStyles({
...@@ -356,6 +357,8 @@ const Login = ({ ...@@ -356,6 +357,8 @@ const Login = ({
}); });
}; };
toLoginPage({ replace: true, callbackUrl: false });
useEffect(() => { useEffect(() => {
if (loadingFetchConfiguration) { if (loadingFetchConfiguration) {
api api
...@@ -524,25 +527,25 @@ const Login = ({ ...@@ -524,25 +527,25 @@ const Login = ({
{loadingFetchConfiguration ? ( {loadingFetchConfiguration ? (
<CircularProgress className={classes.loadingLoginStrategy} /> <CircularProgress className={classes.loadingLoginStrategy} />
) : ( ) : (
<React.Fragment> <React.Fragment>
<div> <div>
<p>An error has occurred, the backend cannot be reached.</p> <p>An error has occurred, the backend cannot be reached.</p>
</div> </div>
<div> <div>
<Button <Button
onClick={() => { onClick={() => {
fetchConfiguration(); fetchConfiguration();
}} }}
endIcon={<RefreshIcon />} endIcon={<RefreshIcon />}
color={"primary"} color={"primary"}
variant="outlined" variant="outlined"
className={classes.retryButton} className={classes.retryButton}
> >
Retry Retry
</Button> </Button>
</div> </div>
</React.Fragment> </React.Fragment>
)} )}
</div> </div>
); );
} }
......
interface ToLoginPageOptions {
callbackUrl?: boolean | string;
replace?: boolean;
}
/** 跳转到登录页 */ /** 跳转到登录页 */
export const toLoginPage = (callbackUrl: boolean | string = true): void => { export const toLoginPage = (options?: ToLoginPageOptions): void => {
let { callbackUrl = true, replace = false } = options || {};
if (typeof callbackUrl === "boolean" && callbackUrl) { if (typeof callbackUrl === "boolean" && callbackUrl) {
// 如果是 true 就是用当前 url 作为登录成功后回调地址 // 如果是 true 就是用当前 url 作为登录成功后回调地址
callbackUrl = encodeURIComponent(window.location.href); callbackUrl = encodeURIComponent(window.location.href);
} }
const queryStr = callbackUrl ? `?callbackUrl=${callbackUrl}` : ""; const queryStr = callbackUrl ? `?callbackUrl=${callbackUrl}` : "";
let url = `/saturn/login${queryStr}`;
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
let loginUrl = `https://xxyy.co/#/login${queryStr}`; let loginUrl = `https://xxyy.co/#/login${queryStr}`;
...@@ -13,8 +19,11 @@ export const toLoginPage = (callbackUrl: boolean | string = true): void => { ...@@ -13,8 +19,11 @@ export const toLoginPage = (callbackUrl: boolean | string = true): void => {
if (window.location.host.endsWith(".kube.ucas")) { if (window.location.host.endsWith(".kube.ucas")) {
loginUrl = `https://test-www.kube.ucas/login${queryStr}`; loginUrl = `https://test-www.kube.ucas/login${queryStr}`;
} }
window.location.href = loginUrl; url = loginUrl;
}
if (replace) {
window.location.replace(url);
} else { } else {
window.location.href = `/saturn/login${queryStr}`; window.location.href = url;
} }
}; };
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论