summary refs log tree commit diff
path: root/synapse/res
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-04-17 13:34:55 -0400
committerGitHub <noreply@github.com>2020-04-17 13:34:55 -0400
commit054c231e58eb8a93ff04a81341190aa3b6bcb9f7 (patch)
tree6dd6cea76eba8764b1a9a38974b67577a5081dc1 /synapse/res
parentAdded explicit Python build tools to snap requirements (#7213) (diff)
downloadsynapse-054c231e58eb8a93ff04a81341190aa3b6bcb9f7.tar.xz
Use a template for the SSO success page to allow for customization. (#7279)
Diffstat (limited to '')
-rw-r--r--synapse/res/templates/sso_auth_success.html18
-rw-r--r--synapse/rest/client/v2_alpha/auth.py25
2 files changed, 42 insertions, 1 deletions
diff --git a/synapse/res/templates/sso_auth_success.html b/synapse/res/templates/sso_auth_success.html
new file mode 100644
index 0000000000..03f1419467
--- /dev/null
+++ b/synapse/res/templates/sso_auth_success.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+    <title>Authentication Successful</title>
+    <script>
+    if (window.onAuthDone) {
+        window.onAuthDone();
+    } else if (window.opener && window.opener.postMessage) {
+        window.opener.postMessage("authDone", "*");
+    }
+    </script>
+</head>
+    <body>
+        <div>
+            <p>Thank you</p>
+            <p>You may now close this window and return to the application</p>
+        </div>
+    </body>
+</html>
diff --git a/synapse/rest/client/v2_alpha/auth.py b/synapse/rest/client/v2_alpha/auth.py
index 13f9604407..11599f5005 100644
--- a/synapse/rest/client/v2_alpha/auth.py
+++ b/synapse/rest/client/v2_alpha/auth.py
@@ -18,7 +18,6 @@ import logging
 from synapse.api.constants import LoginType
 from synapse.api.errors import SynapseError
 from synapse.api.urls import CLIENT_API_PREFIX
-from synapse.handlers.auth import SUCCESS_TEMPLATE
 from synapse.http.server import finish_request
 from synapse.http.servlet import RestServlet, parse_string
 
@@ -90,6 +89,30 @@ TERMS_TEMPLATE = """
 </html>
 """
 
+SUCCESS_TEMPLATE = """
+<html>
+<head>
+<title>Success!</title>
+<meta name='viewport' content='width=device-width, initial-scale=1,
+    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) {
+    window.onAuthDone();
+} else if (window.opener && window.opener.postMessage) {
+     window.opener.postMessage("authDone", "*");
+}
+</script>
+</head>
+<body>
+    <div>
+        <p>Thank you</p>
+        <p>You may now close this window and return to the application</p>
+    </div>
+</body>
+</html>
+"""
+
 
 class AuthRestServlet(RestServlet):
     """