Ensure that $:/isEncrypted is reset if modified

print-window-tiddler
Jermolene 2014-02-21 18:21:08 +00:00
rodzic 31975e0042
commit dfbb6e1fba
2 zmienionych plików z 12 dodań i 2 usunięć

Wyświetl plik

@ -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() {

Wyświetl plik

@ -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"),