mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +08:00
Add sendSilentSigninData()
This commit is contained in:
@ -512,14 +512,19 @@ class LoginPage extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendSilentSigninData(data) {
|
||||||
|
if (Setting.inIframe()) {
|
||||||
|
const message = {tag: "Casdoor", type: "SilentSignin", data: data};
|
||||||
|
window.parent.postMessage(message, "*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderSignedInBox() {
|
renderSignedInBox() {
|
||||||
if (this.props.account === undefined || this.props.account === null) {
|
if (this.props.account === undefined || this.props.account === null) {
|
||||||
if (window !== window.parent) {
|
this.sendSilentSigninData("user-not-logged-in");
|
||||||
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();
|
||||||
if (this.props.account.owner !== application.organization) {
|
if (this.props.account.owner !== application.organization) {
|
||||||
return null;
|
return null;
|
||||||
@ -528,10 +533,7 @@ class LoginPage extends React.Component {
|
|||||||
const params = new URLSearchParams(this.props.location.search);
|
const params = new URLSearchParams(this.props.location.search);
|
||||||
const silentSignin = params.get("silentSignin");
|
const silentSignin = params.get("silentSignin");
|
||||||
if (silentSignin !== null) {
|
if (silentSignin !== null) {
|
||||||
if (window !== window.parent) {
|
this.sendSilentSigninData("signing-in");
|
||||||
const message = {tag: "Casdoor", type: "SilentSignin", data: "signing-in"};
|
|
||||||
window.parent.postMessage(message, "*");
|
|
||||||
}
|
|
||||||
|
|
||||||
const values = {};
|
const values = {};
|
||||||
values["application"] = this.state.application.name;
|
values["application"] = this.state.application.name;
|
||||||
|
Reference in New Issue
Block a user