فهرست منبع

Updated js/css libraries and fixed smallscreen err

- Updated bootstrap js and css to the latest version
- Fixed issue with small-screens where the menu overlaps the token input
  - The menu now collapses to a hamburger menu
  - Menu's only accessable when logedin are hidden when you are not
- Changed Users Overview to use a table to prevent small-screen issues.
BlackDex 5 سال پیش
والد
کامیت
b47cf97409
4فایلهای تغییر یافته به همراه1996 افزوده شده و 2131 حذف شده
  1. 1582 1892
      src/static/scripts/bootstrap-native-v4.js
  2. 327 140
      src/static/scripts/bootstrap.css
  3. 41 57
      src/static/templates/admin/base.hbs
  4. 46 42
      src/static/templates/admin/users.hbs

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1582 - 1892
src/static/scripts/bootstrap-native-v4.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 327 - 140
src/static/scripts/bootstrap.css


+ 41 - 57
src/static/templates/admin/base.hbs

@@ -1,40 +1,26 @@
 <!DOCTYPE html>
 <html lang="en">
-
 <head>
-    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
+    <meta name="robots" content="noindex,nofollow" />
     <title>Bitwarden_rs Admin Panel</title>
-
     <link rel="stylesheet" href="{{urlpath}}/bwrs_static/bootstrap.css" />
-    <script src="{{urlpath}}/bwrs_static/bootstrap-native-v4.js"></script>
-    <script src="{{urlpath}}/bwrs_static/md5.js"></script>
-    <script src="{{urlpath}}/bwrs_static/identicon.js"></script>
     <style>
         body {
-            padding-top: 70px;
-        }
-
-        @media (max-width:768px) {
-            body {
-                padding-top: 190px;
-            }
-
-            .container {
-                max-width: 100%;
-            }
+            padding-top: 75px;
         }
-
         img {
             width: 48px;
             height: 48px;
         }
-
         .navbar img {
             height: 24px;
             width: auto;
         }
     </style>
+    <script src="{{urlpath}}/bwrs_static/md5.js"></script>
+    <script src="{{urlpath}}/bwrs_static/identicon.js"></script>
     <script>
         function reload() { window.location.reload(); }
         function msg(text, reload_page = true) {
@@ -86,47 +72,44 @@
 </head>
 
 <body class="bg-light">
-    <nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top shadow mb-4">
-    <div class="container">
-        <a class="navbar-brand" href="{{urlpath}}/admin"><img class="pr-1" src="{{urlpath}}/bwrs_static/shield-white.png">Bitwarden_rs Admin</a>
-        <div class="navbar-collapse">
-            <ul class="navbar-nav">
-                <li class="nav-item">
-                    <a class="nav-link" href="{{urlpath}}/admin">Settings</a>
-                </li>
-                <li class="nav-item">
-                    <a class="nav-link" href="{{urlpath}}/admin/users/overview">Users</a>
-                </li>
-                <li class="nav-item">
-                    <a class="nav-link" href="{{urlpath}}/admin/organizations/overview">Organizations</a>
-                </li>
-                <li class="nav-item">
-                    <a class="nav-link" href="{{urlpath}}/admin/diagnostics">Diagnostics</a>
-                </li>
-                <li class="nav-item">
-                    <a class="nav-link" href="{{urlpath}}/">Vault</a>
-                </li>
-            </ul>
-        </div>
+    <nav class="navbar navbar-expand-md navbar-dark bg-dark mb-4 shadow fixed-top">
+        <div class="container">
+            <a class="navbar-brand" href="{{urlpath}}/admin"><img class="pr-1" src="{{urlpath}}/bwrs_static/shield-white.png">Bitwarden_rs Admin</a>
+            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse"
+                    aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
+                <span class="navbar-toggler-icon"></span>
+            </button>
+            <div class="collapse navbar-collapse" id="navbarCollapse">
+                <ul class="navbar-nav mr-auto">
+                {{#if logged_in}}
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{urlpath}}/admin">Settings</a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{urlpath}}/admin/users/overview">Users</a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{urlpath}}/admin/organizations/overview">Organizations</a>
+                    </li>
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{urlpath}}/admin/diagnostics">Diagnostics</a>
+                    </li>
+                {{/if}}
+                    <li class="nav-item">
+                        <a class="nav-link" href="{{urlpath}}/">Vault</a>
+                    </li>
+                </ul>
 
-        <ul class="navbar-nav">
-            {{#if version}}
-            <li class="nav-item">
-                <span class="navbar-text mr-2">Version: {{version}}</span>
-            </li>
-            {{/if}}
-
-            {{#if logged_in}}
-            <li class="nav-item rounded btn-secondary">
-                <a class="nav-link" href="{{urlpath}}/admin/logout">Log Out</a>
-            </li>
-            {{/if}}
-        </ul>
-    </div>
+                {{#if logged_in}}
+                    <a class="btn btn-sm btn-secondary" href="{{urlpath}}/admin/logout">Log Out</a>
+                {{/if}}
+            </div>
+        </div>
     </nav>
 
     {{> (page_content) }}
 
+    <!-- This script needs to be at the bottom, else it will fail! -->
     <script>
         // get current URL path and assign 'active' class to the correct nav-item
         (function () {
@@ -138,6 +121,7 @@
             }
         })();
     </script>
+    <!-- This script needs to be at the bottom, else it will fail! -->
+    <script src="{{urlpath}}/bwrs_static/bootstrap-native-v4.js"></script>
 </body>
-
 </html>

+ 46 - 42
src/static/templates/admin/users.hbs

@@ -2,57 +2,61 @@
     <div id="users-block" class="my-3 p-3 bg-white rounded shadow">
         <h6 class="border-bottom pb-2 mb-0">Registered Users</h6>
 
-        <div id="users-list">
-            {{#each users}}
-            <div class="media pt-3">
-                <img class="mr-2 rounded identicon" data-src="{{Email}}">
-                <div class="media-body pb-3 mb-0 small border-bottom">
-                    <div class="row justify-content-between">
-                        <div class="col">
+
+
+        <div class="table-responsive-xl small">
+            <table class="table table-sm table-striped table-hover">
+                <thead>
+                    <tr>
+                        <th style="width: 24px;">User</th>
+                        <th></th>
+                        <th style="width:90px; min-width: 90px;">Items</th>
+                        <th style="min-width: 140px;">Organizations</th>
+                        <th style="width: 140px; min-width: 140px;">Actions</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    {{#each users}}
+                    <tr>
+                        <td><img class="mr-2 rounded identicon" data-src="{{Email}}"></td>
+                        <td>
                             <strong>{{Name}}</strong>
-                            {{#if TwoFactorEnabled}}
-                            <span class="badge badge-success ml-2">2FA</span>
-                            {{/if}}
-                            {{#case _Status 1}}
-                            <span class="badge badge-warning ml-2">Invited</span>
-                            {{/case}}
-                            <span class="d-block">{{Email}}
+                            <span class="d-block">{{Email}}</span>
+                            <span class="d-block">
+                                {{#if TwoFactorEnabled}}
+                                    <span class="badge badge-success mr-2" title="2FA is enabled">2FA</span>
+                                {{/if}}
+                                {{#case _Status 1}}
+                                    <span class="badge badge-warning mr-2" title="User is invited">Invited</span>
+                                {{/case}}
                                 {{#if EmailVerified}}
-                                <span class="badge badge-success ml-2">Verified</span>
+                                    <span class="badge badge-success mr-2" title="Email has been verified">Verified</span>
                                 {{/if}}
                             </span>
-                        </div>
-                        <div class="col">
-                            <strong> Personal Items: </strong>
-                            <span class="d-block">
-                                {{cipher_count}}
-                            </span>
-                        </div>
-                        <div class="col-4">
-                            <strong> Organizations: </strong>
-                            <span class="d-block">
-                                {{#each Organizations}}
-                                <span class="badge badge-primary" data-orgtype="{{Type}}">{{Name}}</span>
-                                {{/each}}
-                            </span>
-                        </div>
-                        <div class="col" style="font-size: 90%; text-align: right; padding-right: 15px">
+                        </td>
+                        <td>
+                            <span class="d-block">{{cipher_count}}</span>
+                        </td>
+                        <td>
+                            {{#each Organizations}}
+                            <span class="badge badge-primary" data-orgtype="{{Type}}">{{Name}}</span>
+                            {{/each}}
+                        </td>
+                        <td style="font-size: 90%; text-align: right; padding-right: 15px">
                             {{#if TwoFactorEnabled}}
-                            <a class="mr-2" href="#" onclick='remove2fa({{jsesc Id}})'>Remove all 2FA</a>
+                            <a class="d-block" href="#" onclick='remove2fa({{jsesc Id}})'>Remove all 2FA</a>
                             {{/if}}
-
-                            <a class="mr-2" href="#" onclick='deauthUser({{jsesc Id}})'>Deauthorize sessions</a>
-                            <a class="mr-2" href="#" onclick='deleteUser({{jsesc Id}}, {{jsesc Email}})'>Delete User</a>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            {{/each}}
-
+                            <a class="d-block" href="#" onclick='deauthUser({{jsesc Id}})'>Deauthorize sessions</a>
+                            <a class="d-block" href="#" onclick='deleteUser({{jsesc Id}}, {{jsesc Email}})'>Delete User</a>
+                        </td>
+                    </tr>
+                    {{/each}}
+                </tbody>
+            </table>
         </div>
 
         <div class="mt-3">
-            <button type="button" class="btn btn-sm btn-link" onclick="updateRevisions();"
+            <button type="button" class="btn btn-sm btn-danger" onclick="updateRevisions();"
                 title="Force all clients to fetch new data next time they connect. Useful after restoring a backup to remove any stale data.">
                 Force clients to resync
             </button>

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است