]> git.ipfire.org Git - ipfire.org.git/commitdiff
users: Only show recent users to staff
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Sep 2025 09:41:57 +0000 (09:41 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Sep 2025 09:41:57 +0000 (09:41 +0000)
This just makes things a little bit easier later...

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/users/index.html

index 4683cff8a53fc36b21117533f8dafda11b30bf8e..7d1f4659d7c3bc2712f83340825b8023effbfca0 100644 (file)
@@ -71,7 +71,7 @@
                        </div>
                </section>
 
-       {% else %}
+       {% elif current_user and current_user.is_staff() %}
                {# Recently Joined #}
 
                {% set recently_registered = backend.accounts.get_recently_registered(limit=4) %}
                        </section>
                {% end %}
 
-               {% if current_user and current_user.is_staff() %}
-                       {% set total_accounts = len(backend.accounts) %}
-                       {% set countries = backend.accounts.countries %}
+               {% set total_accounts = len(backend.accounts) %}
+               {% set countries = backend.accounts.countries %}
 
-                       {# Stats #}
+               {# Stats #}
 
-                       <section class="section">
-                               <div class="container">
-                                       <div class="level">
-                                               <div class="level-item has-text-centered">
-                                                       <div>
-                                                               <p class="heading">{{ _("Total Accounts") }}</p>
-                                                               <p class="title">
-                                                                       {{ total_accounts }}
-                                                               </p>
-                                                       </div>
+               <section class="section">
+                       <div class="container">
+                               <div class="level">
+                                       <div class="level-item has-text-centered">
+                                               <div>
+                                                       <p class="heading">{{ _("Total Accounts") }}</p>
+                                                       <p class="title">
+                                                               {{ total_accounts }}
+                                                       </p>
                                                </div>
+                                       </div>
 
-                                               {% set t = now - datetime.timedelta(days=7) %}
+                                       {% set t = now - datetime.timedelta(days=7) %}
 
-                                               <div class="level-item has-text-centered">
-                                                       <div>
-                                                               <p class="heading">{{ _("Created This Week") }}</p>
-                                                               <p class="title">
-                                                                       {{ backend.accounts.count_created_after(t) }}
-                                                               </p>
-                                                       </div>
+                                       <div class="level-item has-text-centered">
+                                               <div>
+                                                       <p class="heading">{{ _("Created This Week") }}</p>
+                                                       <p class="title">
+                                                               {{ backend.accounts.count_created_after(t) }}
+                                                       </p>
                                                </div>
+                                       </div>
 
-                                               {% set t = now - datetime.timedelta(days=30) %}
+                                       {% set t = now - datetime.timedelta(days=30) %}
 
+                                       <div class="level-item has-text-centered">
+                                               <div>
+                                                       <p class="heading">{{ _("Created This Month") }}</p>
+                                                       <p class="title">
+                                                               {{ backend.accounts.count_created_after(t) }}
+                                                       </p>
+                                               </div>
+                                       </div>
+
+                                       {% set pending_registrations = backend.accounts.pending_registrations %}
+                                       {% if pending_registrations %}
                                                <div class="level-item has-text-centered">
                                                        <div>
-                                                               <p class="heading">{{ _("Created This Month") }}</p>
+                                                               <p class="heading">{{ _("Pending Registrations") }}</p>
                                                                <p class="title">
-                                                                       {{ backend.accounts.count_created_after(t) }}
+                                                                       {{ pending_registrations }}
                                                                </p>
                                                        </div>
                                                </div>
-
-                                               {% set pending_registrations = backend.accounts.pending_registrations %}
-                                               {% if pending_registrations %}
-                                                       <div class="level-item has-text-centered">
-                                                               <div>
-                                                                       <p class="heading">{{ _("Pending Registrations") }}</p>
-                                                                       <p class="title">
-                                                                               {{ pending_registrations }}
-                                                                       </p>
-                                                               </div>
-                                                       </div>
-                                               {% end %}
-                                       </div>
+                                       {% end %}
                                </div>
-                       </section>
-
-                       {# Countries #}
+                       </div>
+               </section>
 
-                       <section class="section">
-                               <div class="container">
-                                       <h4 class="title is-4">{{ _("Origin") }}</h4>
+               {# Countries #}
 
-                                       <nav class="panel">
-                                               {% for country in sorted(countries, key=lambda c: countries[c], reverse=True) %}
-                                                       {% set percentage = countries[country] / total_accounts %}
+               <section class="section">
+                       <div class="container">
+                               <h4 class="title is-4">{{ _("Origin") }}</h4>
 
-                                                       <div class="panel-block is-justify-content-space-between">
-                                                               <span>
-                                                                       <span class="panel-icon">
-                                                                               <i class="flag-icon flag-icon-{{ country.alpha2.lower() }}"
-                                                                                       aria-hidden="true"></i>
-                                                                       </span>
+                               <nav class="panel">
+                                       {% for country in sorted(countries, key=lambda c: countries[c], reverse=True) %}
+                                               {% set percentage = countries[country] / total_accounts %}
 
-                                                                       {{ country.apolitical_name }}
+                                               <div class="panel-block is-justify-content-space-between">
+                                                       <span>
+                                                               <span class="panel-icon">
+                                                                       <i class="flag-icon flag-icon-{{ country.alpha2.lower() }}"
+                                                                               aria-hidden="true"></i>
                                                                </span>
 
-                                                               <span class="tag">
-                                                                       {{ "%.1f%%" % (percentage * 100) }}
-                                                               </span>
-                                                       </div>
-                                               {% end %}
-                                       </div>
+                                                               {{ country.apolitical_name }}
+                                                       </span>
+
+                                                       <span class="tag">
+                                                               {{ "%.1f%%" % (percentage * 100) }}
+                                                       </span>
+                                               </div>
+                                       {% end %}
                                </div>
-                       </section>
-               {% end %}
+                       </div>
+               </section>
        {% end %}
 {% end block %}