From 7e0e84ae2105e946eed70e75c44c5d16848da6db Mon Sep 17 00:00:00 2001 From: perploug Date: Thu, 31 Oct 2013 12:44:11 +0100 Subject: [PATCH] fixes: non-configured install doesnt redirect Adds install info to servervars, adds information to login screen about going to the installer --- .../src/common/services/user.service.js | 8 +++++- .../views/common/dialogs/login.controller.js | 7 ++++- .../src/views/common/dialogs/login.html | 12 ++++++++- .../views/common/dialogs/user.controller.js | 2 ++ .../src/views/common/dialogs/user.html | 2 ++ .../Editors/BackOfficeController.cs | 26 ++++++++++++++++++- 6 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/user.service.js b/src/Umbraco.Web.UI.Client/src/common/services/user.service.js index 06cc7289b3..213982b2ba 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/user.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/user.service.js @@ -105,6 +105,8 @@ angular.module('umbraco.services') /** Called to update the current user's timeout */ function setUserTimeoutInternal(newTimeout) { + + var asNumber = parseFloat(newTimeout); if (!isNaN(asNumber) && currentUser && angular.isNumber(asNumber)) { currentUser.remainingAuthSeconds = newTimeout; @@ -118,7 +120,11 @@ angular.module('umbraco.services') if (currentUser && currentUser.id !== undefined) { lastUserId = currentUser.id; } - currentUser.remainingAuthSeconds = 0; + + if(currentUser){ + currentUser.remainingAuthSeconds = 0; + } + lastServerTimeoutSet = null; currentUser = null; diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js index 78258427d2..ae76dda00e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.controller.js @@ -1,4 +1,4 @@ -angular.module("umbraco").controller("Umbraco.Dialogs.LoginController", function ($scope, userService, legacyJsLoader, $routeParams) { +angular.module("umbraco").controller("Umbraco.Dialogs.LoginController", function ($scope, userService, legacyJsLoader, $routeParams, $window) { /** * @ngdoc function @@ -15,6 +15,11 @@ $scope.today = weekday[d.getDay()]; $scope.errorMsg = ""; + //this means the application is not configured and needs the installer + if(!Umbraco.Sys.ServerVariables.application){ + $scope.missingConfiguration = true; + } + $scope.loginSubmit = function (login, password) { //if the login and password are not empty we need to automatically diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.html index e9376b00f2..6ece7c8bae 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/login.html @@ -1,6 +1,16 @@ 
-
+ +
+

Umbraco has not yet been installed, + or you need to perform an upgrade. + Please open the umbraco installer +

+ + Open installer +
+ +

Happy {{today}}!

Session timed out. Log in below

diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.controller.js index 829af7e28f..8f440c641d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.controller.js @@ -3,6 +3,8 @@ angular.module("umbraco") $scope.user = userService.getCurrentUser(); $scope.history = historyService.current; + $scope.version = Umbraco.Sys.ServerVariables.application.version + " assembly: " + Umbraco.Sys.ServerVariables.application.assemblyVersion; + $scope.logout = function () { userService.logout().then(function () { diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.html index ed112429f7..488e982719 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/user.html @@ -44,5 +44,7 @@
+ + {{version}}
\ No newline at end of file diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 3b6a4af611..f02f84b57a 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -180,12 +180,36 @@ namespace Umbraco.Web.Editors {"trees", GetTreePluginsMetaData()} } }, - {"isDebuggingEnabled", HttpContext.IsDebuggingEnabled} + {"isDebuggingEnabled", HttpContext.IsDebuggingEnabled}, + { + "application", getApplicationState() + } }; + return JavaScript(ServerVariablesParser.Parse(d)); } + + private Dictionary getApplicationState() + { + if (!ApplicationContext.IsConfigured) + return null; + + var app = new Dictionary(); + app.Add("assemblyVersion", UmbracoVersion.AssemblyVersion); + app.Add("isReady", ApplicationContext.IsReady); + app.Add("isConfigured", ApplicationContext.IsConfigured); + app.Add("isDatabaseConfigured", ApplicationContext.DatabaseContext.IsDatabaseConfigured); + + var version = string.IsNullOrEmpty(UmbracoVersion.CurrentComment) + ? UmbracoVersion.Current.ToString(3) + : string.Format("{0}-{1}", UmbracoVersion.Current.ToString(3), UmbracoVersion.CurrentComment); + + app.Add("version", version); + + return app; + } private IEnumerable> GetTreePluginsMetaData()