mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
Ensure that $:/isEncrypted is reset if modified
This commit is contained in:
parent
31975e0042
commit
dfbb6e1fba
@ -556,8 +556,12 @@ $tw.utils.Crypto = function() {
|
||||
this.updateCryptoStateTiddler();
|
||||
};
|
||||
this.updateCryptoStateTiddler = function() {
|
||||
if($tw.wiki && $tw.wiki.addTiddler) {
|
||||
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: currentPassword ? "yes" : "no"}));
|
||||
if($tw.wiki) {
|
||||
var state = currentPassword ? "yes" : "no",
|
||||
tiddler = $tw.wiki.getTiddler("$:/isEncrypted");
|
||||
if(!tiddler || tiddler.fields.text !== state) {
|
||||
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: state}));
|
||||
}
|
||||
}
|
||||
};
|
||||
this.hasPassword = function() {
|
||||
|
@ -157,6 +157,12 @@ exports.startup = function() {
|
||||
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
|
||||
$tw.crypto.setPassword(null);
|
||||
});
|
||||
// Ensure that $:/isEncrypted is maintained properly
|
||||
$tw.wiki.addEventListener("change",function(changes) {
|
||||
if($tw.utils.hop(changes,"$:/isEncrypted")) {
|
||||
$tw.crypto.updateCryptoStateTiddler();
|
||||
}
|
||||
});
|
||||
// Set up the favicon
|
||||
var faviconTitle = "$:/favicon.ico",
|
||||
faviconLink = document.getElementById("faviconLink"),
|
||||
|
Loading…
Reference in New Issue
Block a user