summary refs log tree commit diff
path: root/synapse/res/templates/saml_error.html
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-03-11 19:33:16 +0000
committerBrendan Abolivier <babolivier@matrix.org>2020-03-11 19:33:16 +0000
commitb8cfe79ffcc1184547673264563884e0188e47a7 (patch)
tree04688cf8eb233af1b436a393ff2ab980aa28a888 /synapse/res/templates/saml_error.html
parentAdd options to disable setting profile info for prevent changes. (#7053) (diff)
downloadsynapse-b8cfe79ffcc1184547673264563884e0188e47a7.tar.xz
Move the default SAML2 error HTML to a dedicated file
Also add some JS to it to process any error we might have in the URI
(see #6893).
Diffstat (limited to 'synapse/res/templates/saml_error.html')
-rw-r--r--synapse/res/templates/saml_error.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/synapse/res/templates/saml_error.html b/synapse/res/templates/saml_error.html
new file mode 100644
index 0000000000..c112ac833f
--- /dev/null
+++ b/synapse/res/templates/saml_error.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>SSO error</title>
+</head>
+<body>
+    <p>Oops! Something went wrong during authentication<span id="errormsg"></span>.</p>
+    <p>
+        If you are seeing this page after clicking a link sent to you via email, make
+        sure you only click the confirmation link once, and that you open the
+        validation link in the same client you're logging in from.
+    </p>
+    <p>
+        Try logging in again from your Matrix client and if the problem persists
+        please contact the server's administrator.
+    </p>
+
+    <script type="text/javascript">
+        // Error handling to support Auth0 errors that we might get through a GET request
+        // to the validation endpoint. If an error is provided, it's either going to be
+        // located in the query string or in a query string-like URI fragment.
+        // We try to locate the error from any of these two locations, but if we can't
+        // we just don't print anything specific.
+        let searchStr = "";
+        if (window.location.search) {
+            // For some reason window.location.searchParams isn't always defined when
+            // window.location.search is, so we can't just use it right away.
+            searchStr = window.location.search;
+        } else if (window.location.hash) {
+            // Replace the # with a ? so that URLSearchParams does the right thing and
+            // doesn't parse the first parameter incorrectly.
+            searchStr = window.location.hash.replace("#", "?");
+        }
+
+        // We might end up with no error in the URL, so we need to check if we have one
+        // to print one.
+        let errorDesc = new URLSearchParams(searchStr).get("error_description")
+        if (errorDesc) {
+            document.getElementById("errormsg").innerHTML = ` ("${errorDesc}")`;
+        }
+    </script>
+</body>
+</html>
\ No newline at end of file