userlimit.html 6.34 KB
Newer Older
1
<!DOCTYPE html>
2 3

<!--
4
Keel (LDH middleware)
5
Copyright 2017-2018 Purism SPC
6
https://source.puri.sm/liberty/ldh_middleware
David Seaward's avatar
David Seaward committed
7
SPDX-License-Identifier: AGPL-3.0
8 9
-->

10 11
<html lang="en">
<head>
12
    <meta name="viewport" content="width=device-width, initial-scale=1">
David Seaward's avatar
David Seaward committed
13 14
    <link rel="stylesheet" href="{% static 'layout.css' %}"/>
    <link rel="stylesheet" href="{% static 'theme.css' %}"/>
15
    <title>{% trans "User profile" %}</title>
David Seaward's avatar
David Seaward committed
16 17 18
    <link rel="icon" sizes="960x960" href="{% static 'favicon.png' %}"/>
    <meta name="application-name" content="{{ site_title }}"/>
    <meta charset="UTF-8"/>
19 20 21 22
</head>

<body>

David Seaward's avatar
David Seaward committed
23 24
<header>

25
    <div id="title_box">
David Seaward's avatar
David Seaward committed
26
        <a href="{% url 'home' %}"><img class="logo" src="{% static 'logo.png' %}" alt="{{ site_title }}"/></a>
27 28
        <div id="title_text">
            <h1>{% trans "User profile" %}</h1>
29 30 31 32 33 34 35 36 37 38 39 40 41
            {% if request.user.chosenreward.is_pending %}
            <div class="notice">
              <p>
                Your registration is pending.
              </p>
              <p>
                Complete the registration process please visit <a href="{{complete_signup_url}}">{{complete_signup_url}}</a>
              </p>
              <p>
                Pending registrations are removed after 12 hours.
              </p>
            </div>
            {% else %}
42
            <p>{% trans "Service credit and profile management" %}</p>
43
            {% endif %}
44 45
        </div>
    </div>
David Seaward's avatar
David Seaward committed
46

47 48 49 50 51 52 53 54 55 56 57 58
    <div id="log_state">
        {% if request.user.is_authenticated %}
        {% trans "Logged in as" %} {{ username }}<br/>
        <em>{% trans "Profile" %}</em> |

        {% if request.user.is_superuser %}
        <a href="{% url 'admin:index' %}">{% trans "Admin" %}</a> |
        {% endif %}

        <a href="{% url 'auth_logout' %}">{% trans "Log out" %}</a>
        {% else %}
        {% trans "You are not logged in." %}<br/>
59 60 61
        <a href="{% url 'auth_login' %}">{% trans "Log in" %}</a>
        <!--
        {% trans "or" %}
62
        <a href="{% url 'registration_register' %}">{% trans "register." %}</a>
63
        -->
64 65 66 67
        {% endif %}
    </div>
</header>

David Seaward's avatar
David Seaward committed
68 69
<hr/>

70
{% if not request.user.chosenreward.is_pending %}
71 72
<main class="col-wrapper form">
    <article class="col-1">
73

74
        <h2>{% trans "Services" %}</h2>
75

76
        <table>
77 78 79

            <thead>
            <tr>
80 81
                <th>{% trans "Service" %}</th>
                <th>{% trans "Active" %}</th>
82
                <th>{% trans "Renews/Expires" %}</th>
83
                <th>{% trans "Credit" %}</th>
84
                <th>{% trans "Actions" %}</th>
85 86 87 88 89
            </tr>
            </thead>

            <tbody>
            {% for limit in limits %}
90
              {% if limit.service_label() != 'Group' %}
91
            <tr>
92
              <th class="row_header">{{ limit.service_label() }}</th>
93
              </th>
94
                <td>{{ limit.active_label() }}</td>
95
                <td title="{{ limit.endpoint_full_label() }}">{{ limit.endpoint_short_label() }}</td>
96
                <td>{{ limit.credit_label() }}</td>
97
                <td>
98 99
                  <form method="post" action="{{ action_function[limit.service_label().upper()] }}">
                    {% csrf_token %}
100 101 102 103 104 105 106 107 108 109
                    {% if limit.is_active and limit.service_activable_by_user() %}
                    <input type="submit" value="Deactivate"/>
                    {% elif not limit.is_active and limit.service_activable_by_user() %}
                    <input type="submit" value="Activate"/>
                    {% else %}
                    <input type="submit" value="---" disabled/>
                    {% endif %}
                    <input type="hidden" name="enable_tunnel" value="{{ not limit.is_active }}"/>
                  </form>
                </td>
110
            </tr>
111
              {% endif %}
112 113
            {% endfor %}
            </tbody>
114

115
        </table>
116

117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
        {% if has_limit["GROUP"]%}

          <h2>{% trans "Group members" %}</h2>
            <ul>
              {% if invitations['no_members'] %}
                <li>{% trans "None" %}</li>
              {% else %}
                {% for invitation in invitations['list'] %}
                  {% if invitation['consumed'] %}
                    <li>{{ invitation.guest }}</li>
                  {% endif %}
                {% endfor %}
              {% endif%}
            </ul>
          <h2>{% trans "Group invites" %}</h2>
            <ul>
              {% if not invitations['links_not_used'] %}
                <li>{% trans "None left" %}</li>
              {% else %}
                {% for invitation in invitations['list'] %}
                  {% if not invitation['expired'] and not invitation['consumed'] %}
                    <li><a href="{{ invitation["link"] }}">{{ invitation["link"] }}</a></li>
                  {% endif %}
                {% endfor %}
              {% endif %}
            </ul>
          <form method="post" action="{% url 'new_invitation' %}">
            {% csrf_token %}
                    {% if invitations["full"] %}
                    <input type="submit" value="New invitation" disabled/>
                    {% else %}
                    <input type="submit" value="New invitation"/>
                    {% endif %}
          </form>

        {% endif %}

154 155 156 157 158 159 160 161
        {% if DEBUG_CHANGE_PASSWORD %}
        <h2>{% trans "Profile management" %}</h2>

        <ul>
            <li><a href="{% url 'auth_password_change' %}">{% trans "Change password" %}</a></li>
        </ul>
        {% endif %}

162
    </article>
163
    <nav class="col-2">
164 165
        <ul>

166 167 168 169 170 171 172 173 174 175 176
            {% for section, link_ordered_dict in link_profile_ordered_dict.items() %}
            <li>
                {{ section }}
                <ul>

                    {% for name, link in link_ordered_dict.items() %}
                    <li><a href="{{ link }}" class="page">{{ name }}</a></li>
                    {% endfor %}

                </ul>
            </li>
177 178 179 180
            {% endfor %}

        </ul>
    </nav>
David Seaward's avatar
David Seaward committed
181
</main>
182
{% endif %}
David Seaward's avatar
David Seaward committed
183 184 185 186
<footer>
    <div id="footer_block">

        <p>
187 188
            <em>{{ site_title }}</em> provided by <a href="{{ site_provider_link }}">{{ site_provider }}</a><br />
            Code shared under AGPL-3.0-or-later
189
            (<a href="https://source.puri.sm/liberty/ldh_middleware">project</a>,
190 191
            <a href="{% url 'download-zip' %}">source</a>,
            <a href="{% url 'jslicense' %}" rel="jslicense">javascript</a>)
David Seaward's avatar
David Seaward committed
192 193 194 195
        </p>

    </div>
</footer>
196 197 198

</body>
</html>