MM-53147 Support for embedding Mattermost in an MSTeams iframe (#23776)
* add teams to allowed frame-ancestors * fix unit tests * set SameSite attribute for session cookie * further restrict ancestors * skip landing page if in iframe * Only set cookie SameSite=None if embedded in iframe * don't set MMEMBED cookie on landing page (check only) * fully parse MMEMBED cookie * add comment * more comments --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -79,6 +79,20 @@ export default class LinkingLandingPage extends PureComponent<Props, State> {
|
||||
return landingPreference && landingPreference === LandingPreferenceTypes.BROWSER;
|
||||
};
|
||||
|
||||
isEmbedded = () => {
|
||||
// this cookie is set by any plugin that facilitates iframe embedding (e.g. mattermost-plugin-msteams-sync).
|
||||
const cookieName = 'MMEMBED';
|
||||
const cookies = document.cookie.split(';');
|
||||
for (let i = 0; i < cookies.length; i++) {
|
||||
const cookie = cookies[i].trim();
|
||||
if (cookie.startsWith(cookieName + '=')) {
|
||||
const value = cookie.substring(cookieName.length + 1);
|
||||
return decodeURIComponent(value) === '1';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
checkLandingPreferenceApp = () => {
|
||||
const landingPreference = BrowserStore.getLandingPreference(this.props.siteUrl);
|
||||
return landingPreference && landingPreference === LandingPreferenceTypes.MATTERMOSTAPP;
|
||||
@@ -435,7 +449,7 @@ export default class LinkingLandingPage extends PureComponent<Props, State> {
|
||||
render() {
|
||||
const isMobile = UserAgent.isMobile();
|
||||
|
||||
if (this.checkLandingPreferenceBrowser()) {
|
||||
if (this.checkLandingPreferenceBrowser() || this.isEmbedded()) {
|
||||
this.openInBrowser();
|
||||
return null;
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user