зеркало из https://github.com/mozilla/treeherder.git
persona fixes - add username
This commit is contained in:
Родитель
ffa184d907
Коммит
d0b3b8dfb5
|
@ -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');
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<a class="persona-button orange" ng-if="user.loggedin" ng-click="logout()"><span>Logout</span></a>
|
||||
<a class="persona-button orange" ng-if="!user.loggedin" ng-click="login()"><span>Login with persona</span></a>
|
||||
<a class="persona-button blue" ng-if="user.loggedin" ng-click="logout()"><span>Logout</span></a>
|
||||
<a class="persona-button blue" ng-if="!user.loggedin" ng-click="login()"><span>Login with persona</span></a>
|
||||
|
|
Загрузка…
Ссылка в новой задаче