dashboard: add confirmation dialog, fix button in firefox (#2841)

This commit is contained in:
Caleb Doxsey 2021-12-21 14:12:41 -07:00 committed by GitHub
parent f48191fe45
commit 0ee6a72c02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -198,7 +198,7 @@
<tr>
<td>{{.ID}}</td>
<td>
<form action="{{$.WebAuthnURL}}" method="POST">
<form action="{{$.WebAuthnURL}}" method="POST" class="delete-credential-form">
{{$.csrfField}}
<input type="hidden" name="action" value="unregister">
<input type="hidden" name="pomerium_device_credential_id" value="{{.ID}}">
@ -229,7 +229,7 @@
<tr>
<td>{{.ID}}</td>
<td>
<form action="{{$.WebAuthnURL}}" method="POST">
<form action="{{$.WebAuthnURL}}" method="POST" class="delete-credential-form">
{{$.csrfField}}
<input type="hidden" name="action" value="unregister">
<input type="hidden" name="pomerium_device_credential_id" value="{{.ID}}">
@ -262,5 +262,18 @@
</div>
</body>
<script>
function onDeleteDeviceCredential(evt) {
if (!confirm("Are you sure you want to delete this device credential? If a policy requires an approved device you may need to request a new approval from your administrator.")) {
evt.preventDefault();
}
}
Array.from(document.getElementsByClassName("delete-credential-form")).forEach(function(el) {
el.addEventListener("submit", onDeleteDeviceCredential);
});
</script>
</html>
{{end}}

View file

@ -488,6 +488,7 @@ a.button {
display: inline-block;
text-decoration: none;
text-transform: none;
white-space: nowrap;
transition: box-shadow 150ms ease-in-out;
}