From 97359ec87f1e84a15d3c00df2bd5102a02cd7251 Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Mon, 22 Jun 2020 16:33:00 +0200 Subject: [PATCH] #1401 Store the user's homepage on the currentUser object and use that URL as a link for the header's logo. --- .../app/scripts/services/api/AuthenticationSrv.js | 12 ++++++++++-- frontend/app/views/components/header.component.html | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/app/scripts/services/api/AuthenticationSrv.js b/frontend/app/scripts/services/api/AuthenticationSrv.js index 4c12d0e015..8643165ddd 100644 --- a/frontend/app/scripts/services/api/AuthenticationSrv.js +++ b/frontend/app/scripts/services/api/AuthenticationSrv.js @@ -5,6 +5,7 @@ .factory('AuthenticationSrv', function($http, $q, UtilsSrv, SecuritySrv, UserSrv) { var self = { currentUser: null, + homeState: null, login: function(username, password, code) { var post = { user: username, @@ -49,8 +50,15 @@ var userData = response.data; self.currentUser = userData; - UserSrv.updateCache(userData.login, userData); - UtilsSrv.shallowClearAndCopy(userData, result); + + if(self.isSuperAdmin()) { + self.currentUser.homeState = 'app.administration.organisations'; + } else { + self.currentUser.homeState = 'app.cases'; + } + + UserSrv.updateCache(self.currentUser.login, self.currentUser); + UtilsSrv.shallowClearAndCopy(self.currentUser, result); return $q.resolve(result); }) diff --git a/frontend/app/views/components/header.component.html b/frontend/app/views/components/header.component.html index 7008041519..7ffeb46a8b 100644 --- a/frontend/app/views/components/header.component.html +++ b/frontend/app/views/components/header.component.html @@ -7,7 +7,8 @@ - + + TheHive