diff options
author | Nikolay Nikolaev <[email protected]> | 2023-03-30 15:23:16 +0300 |
---|---|---|
committer | Nikolay Nikolaev <[email protected]> | 2023-03-30 15:23:16 +0300 |
commit | dcaaa430f046a3c65b5c278d5c7f23b1092fe33e (patch) | |
tree | c6ce23a43066fd9ab5b1ecb91d1f3b30d50e7e06 /src/static | |
parent | 525e6bb65a6926e0f9de3fc5dafd5c5b63981f9f (diff) | |
download | vaultwarden-dcaaa430f046a3c65b5c278d5c7f23b1092fe33e.tar.gz vaultwarden-dcaaa430f046a3c65b5c278d5c7f23b1092fe33e.zip |
support `/users/<uuid>/invite/resend` admin api
Diffstat (limited to 'src/static')
-rw-r--r-- | src/static/scripts/admin_users.js | 21 | ||||
-rw-r--r-- | src/static/templates/admin/users.hbs | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/static/scripts/admin_users.js b/src/static/scripts/admin_users.js index 444bc77c..0eac278c 100644 --- a/src/static/scripts/admin_users.js +++ b/src/static/scripts/admin_users.js @@ -120,6 +120,24 @@ function inviteUser(event) { ); } +function resendUserInvite (event) { + event.preventDefault(); + event.stopPropagation(); + const id = event.target.parentNode.dataset.vwUserUuid; + const email = event.target.parentNode.dataset.vwUserEmail; + if (!id) { + alert("Required parameters not found!"); + return false; + } + const confirmed = confirm(`Are you sure you want to resend invitation for "${email}"?`); + if (confirmed) { + _post(`${BASE_URL}/admin/users/${id}/invite/resend`, + "Invite sent successfully", + "Error resend invite" + ); + } +} + const ORG_TYPES = { "0": { "name": "Owner", @@ -228,6 +246,9 @@ function initUserTable() { document.querySelectorAll("button[vw-enable-user]").forEach(btn => { btn.addEventListener("click", enableUser); }); + document.querySelectorAll("button[vw-resend-user-invite]").forEach(btn => { + btn.addEventListener("click", resendUserInvite); + }); if (jdenticon) { jdenticon(); diff --git a/src/static/templates/admin/users.hbs b/src/static/templates/admin/users.hbs index 9d9c684d..bdb2870f 100644 --- a/src/static/templates/admin/users.hbs +++ b/src/static/templates/admin/users.hbs @@ -72,6 +72,9 @@ {{else}} <button type="button" class="btn btn-sm btn-link p-0 border-0 float-right" vw-enable-user>Enable User</button><br> {{/if}} + {{#case _Status 1}} + <button type="button" class="btn btn-sm btn-link p-0 border-0 float-right" vw-resend-user-invite>Resend invite</button><br> + {{/case}} </span> </td> </tr> |