diff --git a/modules/core/client/controllers/header.client.controller.js b/modules/core/client/controllers/header.client.controller.js index f4712204..b11921bc 100644 --- a/modules/core/client/controllers/header.client.controller.js +++ b/modules/core/client/controllers/header.client.controller.js @@ -26,7 +26,7 @@ $scope.$on('$stateChangeSuccess', stateChangeSuccess); - $scope.$on('auth-user-score-changed', function(event, args) { + $scope.$on('auth-user-changed', function(event, args) { vm.user = Authentication.user; vm.scoreLevelData = vm.user ? ScoreLevelService.getScoreLevelJson(vm.user.score) : undefined; }); diff --git a/modules/core/client/directives/score-level.client.directive.js b/modules/core/client/directives/score-level.client.directive.js index 5dc5f6f0..cb4576db 100644 --- a/modules/core/client/directives/score-level.client.directive.js +++ b/modules/core/client/directives/score-level.client.directive.js @@ -15,7 +15,7 @@ function link(scope, element, attrs) { scope.$watch(attrs.scoreLevel, function (level) { - console.log('level changed to ' + level); + //console.log('level changed to ' + level); var l = 'L' + (level ? level : 0); l = '' + l + ''; diff --git a/modules/users/client/controllers/authentication.client.controller.js b/modules/users/client/controllers/authentication.client.controller.js index 73756913..75a4f89f 100644 --- a/modules/users/client/controllers/authentication.client.controller.js +++ b/modules/users/client/controllers/authentication.client.controller.js @@ -6,10 +6,10 @@ .controller('AuthenticationController', AuthenticationController); AuthenticationController.$inject = ['$scope', '$state', 'UsersService', '$location', '$window', 'Authentication', 'PasswordValidator', 'Notification', - 'MeanTorrentConfig', 'getStorageLangService']; + 'MeanTorrentConfig', 'getStorageLangService', '$rootScope']; function AuthenticationController($scope, $state, UsersService, $location, $window, Authentication, PasswordValidator, Notification, MeanTorrentConfig, - getStorageLangService) { + getStorageLangService, $rootScope) { var vm = this; vm.lang = getStorageLangService.getLang(); @@ -89,6 +89,7 @@ function onUserSignupSuccess(response) { // If successful we assign the response to the global user model vm.authentication.user = response; + $rootScope.$broadcast('auth-user-changed'); Notification.success({message: ' Signup successful!'}); // And redirect to the previous or home page $state.go($state.previous.state.name || 'home', $state.previous.params); @@ -109,6 +110,7 @@ function onUserSigninSuccess(response) { // If successful we assign the response to the global user model vm.authentication.user = response; + $rootScope.$broadcast('auth-user-changed'); Notification.info({message: 'Welcome ' + response.firstName}); // And redirect to the previous or home page $state.go($state.previous.state.name || 'home', $state.previous.params); diff --git a/modules/users/client/controllers/score/score.client.controller.js b/modules/users/client/controllers/score/score.client.controller.js index 3bfd05de..d4acf78f 100644 --- a/modules/users/client/controllers/score/score.client.controller.js +++ b/modules/users/client/controllers/score/score.client.controller.js @@ -23,7 +23,7 @@ $state.go('authentication.signin'); } - $scope.$on('auth-user-score-changed', function(event, args) { + $scope.$on('auth-user-changed', function(event, args) { vm.user = Authentication.user; vm.scoreLevelData = vm.user ? ScoreLevelService.getScoreLevelJson(vm.user.score) : undefined; }); @@ -59,7 +59,7 @@ function successCallback(res) { if (res._id === vm.user._id) { vm.user = Authentication.user = res; - $rootScope.$broadcast('auth-user-score-changed'); + $rootScope.$broadcast('auth-user-changed'); } NotifycationService.showSuccessNotify('EXCHANGE_INVITATION_SUCCESSFULLY'); }