aboutsummaryrefslogtreecommitdiff
path: root/src/static
diff options
context:
space:
mode:
authorBlackDex <[email protected]>2021-10-08 00:01:24 +0200
committerBlackDex <[email protected]>2021-10-08 00:01:24 +0200
commit338756550a27d1084ae947a1a108482abb8f473b (patch)
tree3cf6b3df6c4cf5a4762e0f3692e4b1f6bd8bbeed /src/static
parent9930a0d75224202dbc355e945724aa545bedebe2 (diff)
downloadvaultwarden-338756550a27d1084ae947a1a108482abb8f473b.tar.gz
vaultwarden-338756550a27d1084ae947a1a108482abb8f473b.zip
Fix error reporting in admin and some small fixes
- Fixed a bug in JavaScript which caused no messages to be shown to the user in-case of an error send by the server. - Changed mail error handling for better error messages - Changed user/org actions from a to buttons, this should prevent strange issues in-case of javascript issues and the page does re-load. - Added Alpine and Debian info for the running docker image During the mail error testing i encountered a bug which caused lettre to panic. This panic only happens on debug builds and not release builds, so no need to update anything on that part. This bug is also already fixed. See https://github.com/lettre/lettre/issues/678 and https://github.com/lettre/lettre/pull/679 Resolves #2021 Could also fix the issue reported here #2022, or at least no hash `#` in the url.
Diffstat (limited to 'src/static')
-rw-r--r--src/static/templates/admin/base.hbs8
-rw-r--r--src/static/templates/admin/diagnostics.hbs4
-rw-r--r--src/static/templates/admin/organizations.hbs4
-rw-r--r--src/static/templates/admin/settings.hbs7
-rw-r--r--src/static/templates/admin/users.hbs12
5 files changed, 17 insertions, 18 deletions
diff --git a/src/static/templates/admin/base.hbs b/src/static/templates/admin/base.hbs
index 94684ede..9c876723 100644
--- a/src/static/templates/admin/base.hbs
+++ b/src/static/templates/admin/base.hbs
@@ -62,8 +62,8 @@
headers: { "Content-Type": "application/json" }
}).then( resp => {
if (resp.ok) { msg(successMsg, reload_page); return Promise.reject({error: false}); }
- respStatus = resp.status;
- respStatusText = resp.statusText;
+ const respStatus = resp.status;
+ const respStatusText = resp.statusText;
return resp.text();
}).then( respText => {
try {
@@ -126,9 +126,9 @@
// get current URL path and assign 'active' class to the correct nav-item
(() => {
- var pathname = window.location.pathname;
+ const pathname = window.location.pathname;
if (pathname === "") return;
- var navItem = document.querySelectorAll('.navbar-nav .nav-item a[href="'+pathname+'"]');
+ let navItem = document.querySelectorAll('.navbar-nav .nav-item a[href="'+pathname+'"]');
if (navItem.length === 1) {
navItem[0].className = navItem[0].className + ' active';
navItem[0].setAttribute('aria-current', 'page');
diff --git a/src/static/templates/admin/diagnostics.hbs b/src/static/templates/admin/diagnostics.hbs
index 4c4575ad..315acc97 100644
--- a/src/static/templates/admin/diagnostics.hbs
+++ b/src/static/templates/admin/diagnostics.hbs
@@ -58,7 +58,7 @@
<dt class="col-sm-5">Running within Docker</dt>
<dd class="col-sm-7">
{{#if page_data.running_within_docker}}
- <span class="d-block"><b>Yes</b></span>
+ <span class="d-block"><b>Yes (Base: {{ page_data.docker_base_image }})</b></span>
{{/if}}
{{#unless page_data.running_within_docker}}
<span class="d-block"><b>No</b></span>
@@ -329,7 +329,7 @@
supportString += "* Vaultwarden version: v{{ version }}\n";
supportString += "* Web-vault version: v{{ page_data.web_vault_version }}\n";
- supportString += "* Running within Docker: {{ page_data.running_within_docker }}\n";
+ supportString += "* Running within Docker: {{ page_data.running_within_docker }} (Base: {{ page_data.docker_base_image }})\n";
supportString += "* Environment settings overridden: ";
{{#if page_data.overrides}}
supportString += "true\n"
diff --git a/src/static/templates/admin/organizations.hbs b/src/static/templates/admin/organizations.hbs
index 35026a50..05509659 100644
--- a/src/static/templates/admin/organizations.hbs
+++ b/src/static/templates/admin/organizations.hbs
@@ -37,8 +37,8 @@
<span class="d-block"><strong>Size:</strong> {{attachment_size}}</span>
{{/if}}
</td>
- <td class="text-end pe-2 small">
- <a class="d-block" href="#" onclick='deleteOrganization({{jsesc Id}}, {{jsesc Name}}, {{jsesc BillingEmail}})'>Delete Organization</a>
+ <td class="text-end px-0 small">
+ <button type="button" class="btn btn-sm btn-link p-0 border-0" onclick='deleteOrganization({{jsesc Id}}, {{jsesc Name}}, {{jsesc BillingEmail}})'>Delete Organization</button>
</td>
</tr>
{{/each}}
diff --git a/src/static/templates/admin/settings.hbs b/src/static/templates/admin/settings.hbs
index b257326b..454891ce 100644
--- a/src/static/templates/admin/settings.hbs
+++ b/src/static/templates/admin/settings.hbs
@@ -219,11 +219,10 @@
onChange(); // Trigger the event initially
checkbox.addEventListener("change", onChange);
}
- // These are formatted because otherwise the
- // VSCode formatter breaks But they still work
- // {{#each config}} {{#if grouptoggle}}
+
+ {{#each config}} {{#if grouptoggle}}
masterCheck("input_{{grouptoggle}}", "#g_{{group}} input");
- // {{/if}} {{/each}}
+ {{/if}} {{/each}}
// Two functions to help check if there were changes to the form fields
// Useful for example during the smtp test to prevent people from clicking save before testing there new settings
diff --git a/src/static/templates/admin/users.hbs b/src/static/templates/admin/users.hbs
index 2f6eb005..be644553 100644
--- a/src/static/templates/admin/users.hbs
+++ b/src/static/templates/admin/users.hbs
@@ -61,16 +61,16 @@
{{/each}}
</div>
</td>
- <td class="text-end pe-2 small">
+ <td class="text-end px-0 small">
{{#if TwoFactorEnabled}}
- <a class="d-block" href="#" onclick='remove2fa({{jsesc Id}})'>Remove all 2FA</a>
+ <button type="button" class="btn btn-sm btn-link p-0 border-0" onclick='remove2fa({{jsesc Id}})'>Remove all 2FA</button>
{{/if}}
- <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>
+ <button type="button" class="btn btn-sm btn-link p-0 border-0" onclick='deauthUser({{jsesc Id}})'>Deauthorize sessions</button>
+ <button type="button" class="btn btn-sm btn-link p-0 border-0" onclick='deleteUser({{jsesc Id}}, {{jsesc Email}})'>Delete User</button>
{{#if user_enabled}}
- <a class="d-block" href="#" onclick='disableUser({{jsesc Id}}, {{jsesc Email}})'>Disable User</a>
+ <button type="button" class="btn btn-sm btn-link p-0 border-0" onclick='disableUser({{jsesc Id}}, {{jsesc Email}})'>Disable User</button>
{{else}}
- <a class="d-block" href="#" onclick='enableUser({{jsesc Id}}, {{jsesc Email}})'>Enable User</a>
+ <button type="button" class="btn btn-sm btn-link p-0 border-0" onclick='enableUser({{jsesc Id}}, {{jsesc Email}})'>Enable User</button>
{{/if}}
</td>
</tr>