mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-05 05:50:19 +08:00
feat: click on the app card to log in automatically (#1049)
This commit is contained in:
@ -504,7 +504,13 @@ class LoginPage extends React.Component {
|
||||
}
|
||||
|
||||
renderSignedInBox() {
|
||||
const params = new URLSearchParams(this.props.location.search);
|
||||
const silentSignin = params.get("silentSignin");
|
||||
if (this.props.account === undefined || this.props.account === null) {
|
||||
if (window !== window.parent) {
|
||||
const message = {tag: "Casdoor", type: "SilentSignin", data: "user-not-logged-in"};
|
||||
window.parent.postMessage(message, "*");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const application = this.getApplicationObj();
|
||||
@ -512,8 +518,6 @@ class LoginPage extends React.Component {
|
||||
return null;
|
||||
}
|
||||
|
||||
const params = new URLSearchParams(this.props.location.search);
|
||||
const silentSignin = params.get("silentSignin");
|
||||
if (silentSignin !== null) {
|
||||
if (window !== window.parent) {
|
||||
const message = {tag: "Casdoor", type: "SilentSignin", data: "signing-in"};
|
||||
|
@ -27,15 +27,23 @@ class SingleCard extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
wrappedAsSilentSigninLink(link) {
|
||||
if (link.startsWith("http")) {
|
||||
link += link.includes("?") ? "&silentSignin=1" : "?silentSignin=1";
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
renderCardMobile(logo, link, title, desc, time, isSingle) {
|
||||
const gridStyle = {
|
||||
width: "100vw",
|
||||
textAlign: "center",
|
||||
cursor: "pointer",
|
||||
};
|
||||
const silentSigninLink = this.wrappedAsSilentSigninLink(link);
|
||||
|
||||
return (
|
||||
<Card.Grid style={gridStyle} onClick={() => Setting.goToLinkSoft(this, link)}>
|
||||
<Card.Grid style={gridStyle} onClick={() => Setting.goToLinkSoft(this, silentSigninLink)}>
|
||||
<img src={logo} alt="logo" height={60} style={{marginBottom: "20px"}} />
|
||||
<Meta
|
||||
title={title}
|
||||
@ -46,6 +54,8 @@ class SingleCard extends React.Component {
|
||||
}
|
||||
|
||||
renderCard(logo, link, title, desc, time, isSingle) {
|
||||
const silentSigninLink = this.wrappedAsSilentSigninLink(link);
|
||||
|
||||
return (
|
||||
<Col style={{paddingLeft: "20px", paddingRight: "20px", paddingBottom: "20px", marginBottom: "20px"}} span={6}>
|
||||
<Card
|
||||
@ -53,7 +63,7 @@ class SingleCard extends React.Component {
|
||||
cover={
|
||||
<img alt="logo" src={logo} style={{width: "100%", height: "210px", objectFit: "scale-down"}} />
|
||||
}
|
||||
onClick={() => Setting.goToLinkSoft(this, link)}
|
||||
onClick={() => Setting.goToLinkSoft(this, silentSigninLink)}
|
||||
style={isSingle ? {width: "320px"} : {width: "100%"}}
|
||||
>
|
||||
<Meta title={title} description={desc} />
|
||||
|
Reference in New Issue
Block a user