summary refs log tree commit diff
path: root/synapse/res/templates/sso_error.html
blob: 69b93d65c13014f798037e096566ee70e5105921 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Authentication failed</title>
        <meta name="viewport" content="width=device-width, user-scalable=no">
        <style type="text/css">
            {% include "sso.css" without context %}

            #error_code {
                margin-top: 56px;
            }
        </style>
    </head>
    <body class="error_page">
{# If an error of unauthorised is returned it means we have actively rejected their login #}
{% if error == "unauthorised" %}
        <header>
            <p>You are not allowed to log in here.</p>
        </header>
{% else %}
        <header>
            <h1>There was an error</h1>
            <p>
                <strong id="errormsg">{{ error_description | e }}</strong>
            </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>
            <div id="error_code">
                <p><strong>Error code</strong></p>
                <p>{{ error | e }}</p>
            </div>
        </header>

        <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) {
                // window.location.searchParams isn't always defined when
                // window.location.search is, so it's more reliable to parse the latter.
                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").innerText = errorDesc;
            }
        </script>
{% endif %}
</body>
</html>