Skip to content

Commit

Permalink
#1401 Store the user's homepage on the currentUser object and use tha…
Browse files Browse the repository at this point in the history
…t URL as a link for the header's logo.
  • Loading branch information
nadouani committed Jun 22, 2020
1 parent b5f75f1 commit 97359ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions frontend/app/scripts/services/api/AuthenticationSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
})
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/views/components/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" ui-sref="app.index()">

<a class="navbar-brand" ui-sref="{{currentUser.homeState}}">
<img alt="TheHive" src="images/logo.white.svg">
</a>
</div>
Expand Down

0 comments on commit 97359ec

Please sign in to comment.