1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Server: Make it more difficult to delete all data

This commit is contained in:
Laurent Cozic 2021-05-25 12:33:19 +02:00
parent e59e3aa7d1
commit b01aa7eb45

View File

@ -1,17 +1,17 @@
<form id="item_form" action="{{{postUrl}}}" method="POST" class="block">
<input type="submit" name="delete_all_button" class="button is-danger" value="Delete all" />
</form>
{{#itemTable}}
{{>table}}
{{/itemTable}}
<form id="item_form" action="{{{postUrl}}}" method="POST" class="block">
<input type="submit" name="delete_all_button" class="button is-danger" value="Delete all" />
</form>
<script>
onDocumentReady(function() {
document.getElementById("item_form").addEventListener('submit', function(event) {
if (event.submitter.getAttribute('name') === 'delete_all_button') {
const ok = confirm('Delete all items?');
if (!ok) event.preventDefault();
const response = prompt('This will DELETE all your notes, and it cannot be undone. If you wish to continue, please type "confirm".');
if (response !== 'confirm') event.preventDefault();
}
});
});