🐛 loginui: fix reload not triggering right after first run setup

This commit is contained in:
Gina Häußge committed 2020-02-26 12:01:24 +01:00
1 parent 73c2baa39e
commit d99af420ac
1 file changed
+9 -2
@@ -8,9 +8,15 @@ $(function() {
var self = this;
self.loginState = parameters[0];
self.access = parameters[1];
self.coreWizardAcl = parameters[2];
self.onUserLoggedOut = self.onUserPermissionsChanged = function() {
if (!self.loginState.hasAllPermissions(self.access.permissions.STATUS, self.access.permissions.SETTINGS_READ) && !CONFIG_FIRST_RUN) {
// reload if user now lacks STATUS & SETTINGS_READ permissions and is not in first run setup, or is in
// first run setup but the ACL wizard has already run and ACL is active
if (!self.loginState.hasAllPermissions(self.access.permissions.STATUS, self.access.permissions.SETTINGS_READ)
&& (!CONFIG_FIRST_RUN || (self.coreWizardAcl
&& self.coreWizardAcl.setup()
&& self.coreWizardAcl.decision()))) {
location.reload();
}
};
@@ -19,6 +25,7 @@ $(function() {
OCTOPRINT_VIEWMODELS.push({
construct: LoginUiViewModel,
dependencies: ["loginStateViewModel", "accessViewModel"]
dependencies: ["loginStateViewModel", "accessViewModel", "coreWizardAclViewModel"],
optional: ["coreWizardAclViewModel"]
});
});