From dc2cae0ecaf167b1f31ffea44885cb695e79ad6e Mon Sep 17 00:00:00 2001
From: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
Date: Tue, 3 May 2022 00:23:52 +0200
Subject: [PATCH 1/6] config parameter forcing iframe, even when using SSO or
CAS
Signed-off-by: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
---
src/main.js | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/main.js b/src/main.js
index 38ac9096..7b74ebc8 100644
--- a/src/main.js
+++ b/src/main.js
@@ -56,16 +56,19 @@ function onIframeLoad () {
}
};
- // Watch for the localStorage change that indicates that an SSO sign in is being attempted
- // eslint-disable-next-line no-proto
- iframe.contentWindow.localStorage.__proto__.setItem = function (...params) {
- // It looks like an SSO or CAS login is being attempted
- if (params[0] === "mx_sso_hs_url" && iframe.contentWindow.location.hash === "#/login") {
- // Kick them to the non-iframed version. A bit jarring but SSO login most likely won't work in the iframe.
- window.location.href = generateUrl('/apps/riotchat/riot/#/login');
- }
- window.localStorage.setItem.apply(this, params);
- };
+ // Setting sso_force_iframe (in config) to false forces iframe even if using SSO or CAS login
+ if (loadState('riotchat', 'sso_force_iframe') !== false) {
+ // Watch for the localStorage change that indicates that an SSO sign in is being attempted
+ // eslint-disable-next-line no-proto
+ iframe.contentWindow.localStorage.__proto__.setItem = function (...params) {
+ // It looks like an SSO or CAS login is being attempted
+ if (params[0] === "mx_sso_hs_url" && iframe.contentWindow.location.hash === "#/login") {
+ // Kick them to the non-iframed version. A bit jarring but SSO login most likely won't work in the iframe.
+ window.location.href = generateUrl('/apps/riotchat/riot/#/login');
+ }
+ window.localStorage.setItem.apply(this, params);
+ };
+ }
}
function iframeHashChanged () {
From 73b0f655e091e1764bd0fdb77444b290348912c9 Mon Sep 17 00:00:00 2001
From: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
Date: Tue, 3 May 2022 13:33:33 +0200
Subject: [PATCH 2/6] fix comment in src/main.js
Signed-off-by: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
---
src/main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main.js b/src/main.js
index 7b74ebc8..a80e0c2d 100644
--- a/src/main.js
+++ b/src/main.js
@@ -56,7 +56,7 @@ function onIframeLoad () {
}
};
- // Setting sso_force_iframe (in config) to false forces iframe even if using SSO or CAS login
+ // Setting sso_force_iframe (in config) to true forces iframe even if using SSO or CAS login
if (loadState('riotchat', 'sso_force_iframe') !== false) {
// Watch for the localStorage change that indicates that an SSO sign in is being attempted
// eslint-disable-next-line no-proto
From 7d4cc9c9cd7907458f251349dceeca661a369758 Mon Sep 17 00:00:00 2001
From: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
Date: Wed, 4 May 2022 21:21:49 +0200
Subject: [PATCH 3/6] includes proposed changes
Signed-off-by: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
---
lib/AppInfo/Application.php | 1 +
lib/Controller/AppController.php | 2 ++
src/components/AdminSettings.vue | 13 +++++++++++++
3 files changed, 16 insertions(+)
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 734debb0..8d8d38d5 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -48,6 +48,7 @@ class Application extends App implements IBootstrap {
'show_labs_settings' => 'true',
'set_custom_permalink' => 'false',
'sso_immediate_redirect' => 'false',
+ 'sso_force_iframe' => 'false',
];
public function __construct(array $urlParams = []) {
diff --git a/lib/Controller/AppController.php b/lib/Controller/AppController.php
index 68a5e5d8..2a7794e0 100644
--- a/lib/Controller/AppController.php
+++ b/lib/Controller/AppController.php
@@ -59,6 +59,8 @@ public function index() {
$this->initialStateService->provideInitialState(Application::APP_ID, 'disable_custom_urls',
$this->config->getAppValue(Application::APP_ID, 'disable_custom_urls', Application::AvailableSettings['disable_custom_urls']));
+ $this->initialStateService->provideInitialState(Application::APP_ID, 'sso_force_iframe',
+ $this->config->getAppValue(Application::APP_ID, 'sso_force_iframe', Application::AvailableSettings['sso_force_iframe']));
$default_server_domain = $this->config->getAppValue(Application::APP_ID, 'base_url', Application::AvailableSettings['base_url']);
$csp = new ContentSecurityPolicy();
diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue
index 529f38c7..3af72ed5 100644
--- a/src/components/AdminSettings.vue
+++ b/src/components/AdminSettings.vue
@@ -78,6 +78,18 @@
for="sso_immediate_redirect"
>{{ t('riotchat', 'Redirect immediately to SSO (requires SSO to be configured on the Matrix Homeserver)') }}
+
+
+
Date: Tue, 10 May 2022 20:19:12 +0200
Subject: [PATCH 4/6] commit suggestion
Update src/components/AdminSettings.vue
Co-authored-by: Gary Kim
Signed-off-by: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
---
src/components/AdminSettings.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue
index 3af72ed5..9d65a266 100644
--- a/src/components/AdminSettings.vue
+++ b/src/components/AdminSettings.vue
@@ -80,7 +80,7 @@
Date: Sun, 15 May 2022 15:21:55 +0200
Subject: [PATCH 5/6] make false a string in condition Signed-off-by:
jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
Signed-off-by: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
---
src/main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main.js b/src/main.js
index a80e0c2d..7751919b 100644
--- a/src/main.js
+++ b/src/main.js
@@ -57,7 +57,7 @@ function onIframeLoad () {
};
// Setting sso_force_iframe (in config) to true forces iframe even if using SSO or CAS login
- if (loadState('riotchat', 'sso_force_iframe') !== false) {
+ if (loadState('riotchat', 'sso_force_iframe') !== 'false') {
// Watch for the localStorage change that indicates that an SSO sign in is being attempted
// eslint-disable-next-line no-proto
iframe.contentWindow.localStorage.__proto__.setItem = function (...params) {
From 8d14841e6a2e05f9943d09c7e25b14e0e93d9754 Mon Sep 17 00:00:00 2001
From: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
Date: Tue, 24 May 2022 13:31:44 +0200
Subject: [PATCH 6/6] Apply suggestions
Co-authored-by: Gary Kim
Signed-off-by: jonathanmmm <32403139+jonathanmmm@users.noreply.github.com>
---
src/components/AdminSettings.vue | 2 +-
src/main.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue
index 9d65a266..e2923ca6 100644
--- a/src/components/AdminSettings.vue
+++ b/src/components/AdminSettings.vue
@@ -88,7 +88,7 @@
+ >{{ t('riotchat', 'Disable redirect to non-iframed version for SSO (make sure to set the headers to allow the SSO or CAS to be iframed)') }}