Add confirmation for clearing password

Fixes #925
This commit is contained in:
Jermolene
2014-10-07 14:35:42 +01:00
parent a0460c391b
commit ef1d531091
2 changed files with 8 additions and 1 deletions
+6 -1
View File
@@ -21,7 +21,7 @@ exports.synchronous = true;
exports.startup = function() {
$tw.rootWidget.addEventListener("tm-set-password",function(event) {
$tw.passwordPrompt.createPrompt({
serviceName: "Set a new password for this TiddlyWiki",
serviceName: $tw.language.getString("Encryption/PromptSetPassword"),
noUserName: true,
submitText: "Set password",
canCancel: true,
@@ -35,6 +35,11 @@ exports.startup = function() {
});
});
$tw.rootWidget.addEventListener("tm-clear-password",function(event) {
if($tw.browser) {
if(!confirm($tw.language.getString("Encryption/ConfirmClearPassword"))) {
return;
}
}
$tw.crypto.setPassword(null);
});
// Ensure that $:/isEncrypted is maintained properly