summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-10-06 18:16:59 +0100
committerRichard van der Hoff <richard@matrix.org>2016-10-06 18:16:59 +0100
commitf382117852f8bcdff8273916052a8cff0dd541ca (patch)
tree59838baa7d234b47aceb4e5e50b30385fe6e31d3 /synapse/rest/client
parentMerge pull request #1146 from matrix-org/erikj/port_script_fix (diff)
downloadsynapse-f382117852f8bcdff8273916052a8cff0dd541ca.tar.xz
window.postmessage for Interactive Auth fallback
If you're a webapp running the fallback in an iframe, you can't set set a
window.onAuthDone function. Let's post a message back to window.opener instead.
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v2_alpha/auth.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/rest/client/v2_alpha/auth.py b/synapse/rest/client/v2_alpha/auth.py
index 58d3cad6a1..8e5577148f 100644
--- a/synapse/rest/client/v2_alpha/auth.py
+++ b/synapse/rest/client/v2_alpha/auth.py
@@ -77,8 +77,10 @@ SUCCESS_TEMPLATE = """
     user-scalable=no, minimum-scale=1.0, maximum-scale=1.0'>
 <link rel="stylesheet" href="/_matrix/static/client/register/style.css">
 <script>
-if (window.onAuthDone != undefined) {
+if (window.onAuthDone) {
     window.onAuthDone();
+} else if (window.opener && window.opener.postMessage) {
+     window.opener.postMessage("authDone", "*");
 }
 </script>
 </head>