From d0b3b8dfb5975c73a5419da0067e122af58b8a89 Mon Sep 17 00:00:00 2001 From: Cameron Dawson Date: Fri, 28 Feb 2014 17:20:59 -0800 Subject: [PATCH] persona fixes - add username --- ui/js/directives.js | 3 +++ ui/js/services/main.js | 1 - ui/partials/persona_buttons.html | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/js/directives.js b/ui/js/directives.js index 585cbbf77..89a2bf792 100755 --- a/ui/js/directives.js +++ b/ui/js/directives.js @@ -943,6 +943,7 @@ treeherder.directive('personaButtons', function($http, $q, $log, $rootScope, loc // check if already know who the current user is // if the user.email value is null, it means that he's not logged in scope.user.email = scope.user.email || localStorageService.get('user.email'); + $rootScope.username = scope.user.email || "guest"; scope.user.loggedin = scope.user.email == null ? false : true; scope.login = function(){ @@ -954,6 +955,7 @@ treeherder.directive('personaButtons', function($http, $q, $log, $rootScope, loc .then(function(response){ scope.user.loggedin = true; scope.user.email = response.data.email; + $rootScope.username = scope.user.email; localStorageService.add('user.email', scope.user.email); },function(){ // logout if the verification failed @@ -964,6 +966,7 @@ treeherder.directive('personaButtons', function($http, $q, $log, $rootScope, loc BrowserId.logout().then(function(response){ scope.user.loggedin = false; scope.user.email = null; + $rootScope.username = "guest"; localStorageService.remove('user.loggedin'); localStorageService.remove('user.email'); }); diff --git a/ui/js/services/main.js b/ui/js/services/main.js index 72087b074..6e45adb23 100755 --- a/ui/js/services/main.js +++ b/ui/js/services/main.js @@ -128,7 +128,6 @@ treeherder.factory('BrowserId', function($http, $q, $log, thServiceDomain){ login: function(requestArgs){ return browserid.getAssertion(requestArgs) .then(function(response) { - $log.warn(response); return browserid.verifyAssertion(response); }); diff --git a/ui/partials/persona_buttons.html b/ui/partials/persona_buttons.html index 146987ce7..b1dd53aee 100644 --- a/ui/partials/persona_buttons.html +++ b/ui/partials/persona_buttons.html @@ -1,2 +1,2 @@ -Logout -Login with persona +Logout +Login with persona