Clear password if decryption fails

print-window-tiddler
Jeremy Ruston 2012-11-16 22:40:56 +00:00
rodzic 0dbe4c0291
commit 9eb10fb21a
1 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -299,8 +299,8 @@ $tw.utils.PasswordPrompt.prototype.createPrompt = function(options) {
var self = this; var self = this;
form.addEventListener("submit",function(event) { form.addEventListener("submit",function(event) {
// Collect the form data // Collect the form data
var data = {}; var data = {},t;
for(var t=0; t<form.elements.length; t++) { for(t=0; t<form.elements.length; t++) {
var e = form.elements[t]; var e = form.elements[t];
if(e.name && e.value) { if(e.name && e.value) {
data[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); promptInfo.form.parentNode.removeChild(promptInfo.form);
self.setWrapperDisplay(); 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(); event.preventDefault();
return false; return false;