1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Clear password if decryption fails

This commit is contained in:
Jeremy Ruston 2012-11-16 22:40:56 +00:00
parent 0dbe4c0291
commit 9eb10fb21a

View File

@ -299,8 +299,8 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
var self = this;
form.addEventListener("submit",function(event) {
// Collect the form data
var data = {};
for(var t=0; t<form.elements.length; t++) {
var data = {},t;
for(t=0; t<form.elements.length; t++) {
var e = form.elements[t];
if(e.name && e.value) {
data[e.name] = e.value;
@ -315,6 +315,14 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
promptInfo.form.parentNode.removeChild(promptInfo.form);
self.setWrapperDisplay();
}
} else {
// Clear the password if the callback returned false
for(t=0; t<form.elements.length; t++) {
var e = form.elements[t];
if(e.name === "password") {
form.elements[t].value = "";
}
}
}
event.preventDefault();
return false;