mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +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();
|
||||||
};
|
};
|
||||||
this.updateCryptoStateTiddler = function() {
|
this.updateCryptoStateTiddler = function() {
|
||||||
if($tw.wiki && $tw.wiki.addTiddler) {
|
if($tw.wiki) {
|
||||||
$tw.wiki.addTiddler(new $tw.Tiddler({title: "$:/isEncrypted", text: currentPassword ? "yes" : "no"}));
|
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() {
|
this.hasPassword = function() {
|
||||||
|
@ -157,6 +157,12 @@ exports.startup = function() {
|
|||||||
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
|
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
|
||||||
$tw.crypto.setPassword(null);
|
$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
|
// Set up the favicon
|
||||||
var faviconTitle = "$:/favicon.ico",
|
var faviconTitle = "$:/favicon.ico",
|
||||||
faviconLink = document.getElementById("faviconLink"),
|
faviconLink = document.getElementById("faviconLink"),
|
||||||
|
Loading…
Reference in New Issue
Block a user