1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 09:00:27 +00:00

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

View File

@ -9,6 +9,8 @@ ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>
ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"?
ConfirmEditShadowTiddler: You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit "<$text text=<<title>>/>"?
DropMessage: Drop here (or click escape to cancel)
Encryption/ConfirmClearPassword: Do you wish to clear the password? This will remove the encryption applied when saving this wiki
Encryption/PromptSetPassword: Set a new password for this TiddlyWiki
InvalidFieldName: Illegal characters in field name "<$text text=<<fieldName>>/>". Fields can only contain lowercase letters, digits and the characters underscore (`_`), hyphen (`-`) and period (`.`)
MissingTiddler/Hint: Missing tiddler "<$text text=<<currentTiddler>>/>" - click {{$:/core/images/edit-button}} to create
RecentChanges/DateFormat: DDth MMM YYYY

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