From ac3f4d598c8f94b724f643997e09d956f906cf7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 30 Jun 2017 09:39:14 +0200 Subject: [PATCH] Fixed onUserLoggedIn/Out not firing correctly on startup anymore Introduced by b205e84d4bb04b6de7751ab88daff63fd825c547 --- src/octoprint/static/js/app/viewmodels/loginstate.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/loginstate.js b/src/octoprint/static/js/app/viewmodels/loginstate.js index e9c3b051..a356ef13 100644 --- a/src/octoprint/static/js/app/viewmodels/loginstate.js +++ b/src/octoprint/static/js/app/viewmodels/loginstate.js @@ -66,7 +66,7 @@ $(function() { }; if (self.startupDeferred !== undefined) { - // Make sure we only fire our "onUserLogged(In|Out)" message when the application + // Make sure we only fire our "onUserLogged(In|Out)" message after the application // has started up. self.startupDeferred.done(process); } else { @@ -135,12 +135,11 @@ $(function() { self.onAllBound = function(allViewModels) { self.allViewModels = allViewModels; + self.startupDeferred.resolve(); + self.startupDeferred = undefined; }; self.onStartup = function() { - self.startupDeferred.resolve(); - self.startupDeferred = undefined; - self.elementUsernameInput = $("#login_user"); self.elementPasswordInput = $("#login_pass"); self.elementLoginButton = $("#login_button");