From 0c8e5380778303cdd3308bed4a15290214841f8b Mon Sep 17 00:00:00 2001 From: Jermolene Date: Mon, 6 Oct 2014 10:02:34 +0100 Subject: [PATCH] Add support for custom password prompts --- boot/boot.js | 8 +++-- .../How to customise the password prompt.tid | 15 +++++++++ .../tiddlers/system/PatchEncryptionPrompt.tid | 33 +++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 editions/dev/tiddlers/from tw5.com/How to customise the password prompt.tid create mode 100644 editions/dev/tiddlers/system/PatchEncryptionPrompt.tid diff --git a/boot/boot.js b/boot/boot.js index 9d838a0d6..02307f600 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1244,10 +1244,14 @@ Decrypt any tiddlers stored within the element with the ID "encryptedArea". The $tw.boot.decryptEncryptedTiddlers = function(callback) { var encryptedArea = document.getElementById("encryptedStoreArea"); if(encryptedArea) { - var encryptedText = encryptedArea.innerHTML; + var encryptedText = encryptedArea.innerHTML, + prompt = "Enter a password to decrypt this TiddlyWiki"; // Prompt for the password + if($tw.utils.hop($tw.boot,"encryptionPrompts")) { + prompt = $tw.boot.encryptionPrompts.decrypt; + } $tw.passwordPrompt.createPrompt({ - serviceName: "Enter a password to decrypt this TiddlyWiki", + serviceName: prompt, noUserName: true, submitText: "Decrypt", callback: function(data) { diff --git a/editions/dev/tiddlers/from tw5.com/How to customise the password prompt.tid b/editions/dev/tiddlers/from tw5.com/How to customise the password prompt.tid new file mode 100644 index 000000000..53eb35433 --- /dev/null +++ b/editions/dev/tiddlers/from tw5.com/How to customise the password prompt.tid @@ -0,0 +1,15 @@ +title: How to customise the password prompt +tags: howto +created: 20141006085526118 +modified: 20141006085526118 + +You can customise the text and appearance of the password prompt that is displayed when encrypted TiddlyWiki files are first opened. + +To do so, create a tiddler tagged {{$:/core/wiki/rawmarkup|$:/core/ui/TagTemplate}} containing: + +# A JavaScript ` +