mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +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() {
|
renderSignedInBox() {
|
||||||
|
const params = new URLSearchParams(this.props.location.search);
|
||||||
|
const silentSignin = params.get("silentSignin");
|
||||||
if (this.props.account === undefined || this.props.account === null) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
const application = this.getApplicationObj();
|
const application = this.getApplicationObj();
|
||||||
@ -512,8 +518,6 @@ class LoginPage extends React.Component {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const params = new URLSearchParams(this.props.location.search);
|
|
||||||
const silentSignin = params.get("silentSignin");
|
|
||||||
if (silentSignin !== null) {
|
if (silentSignin !== null) {
|
||||||
if (window !== window.parent) {
|
if (window !== window.parent) {
|
||||||
const message = {tag: "Casdoor", type: "SilentSignin", data: "signing-in"};
|
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) {
|
renderCardMobile(logo, link, title, desc, time, isSingle) {
|
||||||
const gridStyle = {
|
const gridStyle = {
|
||||||
width: "100vw",
|
width: "100vw",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
};
|
};
|
||||||
|
const silentSigninLink = this.wrappedAsSilentSigninLink(link);
|
||||||
|
|
||||||
return (
|
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"}} />
|
<img src={logo} alt="logo" height={60} style={{marginBottom: "20px"}} />
|
||||||
<Meta
|
<Meta
|
||||||
title={title}
|
title={title}
|
||||||
@ -46,6 +54,8 @@ class SingleCard extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderCard(logo, link, title, desc, time, isSingle) {
|
renderCard(logo, link, title, desc, time, isSingle) {
|
||||||
|
const silentSigninLink = this.wrappedAsSilentSigninLink(link);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col style={{paddingLeft: "20px", paddingRight: "20px", paddingBottom: "20px", marginBottom: "20px"}} span={6}>
|
<Col style={{paddingLeft: "20px", paddingRight: "20px", paddingBottom: "20px", marginBottom: "20px"}} span={6}>
|
||||||
<Card
|
<Card
|
||||||
@ -53,7 +63,7 @@ class SingleCard extends React.Component {
|
|||||||
cover={
|
cover={
|
||||||
<img alt="logo" src={logo} style={{width: "100%", height: "210px", objectFit: "scale-down"}} />
|
<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%"}}
|
style={isSingle ? {width: "320px"} : {width: "100%"}}
|
||||||
>
|
>
|
||||||
<Meta title={title} description={desc} />
|
<Meta title={title} description={desc} />
|
||||||
|
Reference in New Issue
Block a user