This commit is contained in:
Martin Geno 2016-07-11 16:24:51 +02:00
parent 9a0c180b37
commit 5f10149b2a
4 changed files with 6 additions and 11 deletions

View File

@ -21,7 +21,6 @@ angular.module('ffhb', [
amMoment.changeLocale('de'); amMoment.changeLocale('de');
$rootScope.globals = $cookieStore.get('globals') || {}; $rootScope.globals = $cookieStore.get('globals') || {};
if ($rootScope.globals.currentUser) { if ($rootScope.globals.currentUser) {
$rootScope.passphrase = '*****';
$http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line $http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line
} }
}); });

View File

@ -21,6 +21,6 @@
a.btn.btn-link(ng-click="refresh()") a.btn.btn-link(ng-click="refresh()")
span.glyphicon.glyphicon-refresh(aria-hidden="true") span.glyphicon.glyphicon-refresh(aria-hidden="true")
| {{timeRefresh}} Sec | {{timeRefresh}} Sec
form.navbar-form.navbar-right form.navbar-form.navbar-right(ng-class="{'has-warning':globals.currentUser.authdata}")
input.form-control(type="password",ng-change="passphraseUpdate()",ng-model="passphrase",placeholder="Passphrase") input.form-control(type="password",ng-change="passphraseUpdate()",ng-model="passphrase",placeholder="Passphrase")
div(ui-view="",style="margin-top:100px;") div(ui-view="",style="margin-top:100px;")

View File

@ -1,13 +1,12 @@
'use strict'; 'use strict';
angular.module('ffhb') angular.module('ffhb')
.controller('MainCtrl',function($rootScope,$scope,$interval,store,$state,AuthenticationService){ .controller('MainCtrl',function($scope,$interval,store,$state,AuthenticationService){
$scope.isOpen = false; $scope.isOpen = false;
$scope.$state = $state; $scope.$state = $state;
$scope.refresh = store.refresh; $scope.refresh = store.refresh;
if($rootScope.passphrase === undefined){ $scope.passphrase = '';
$rootScope.passphrase = '';
}
var timediff = new Date(1970,1,1); var timediff = new Date(1970,1,1);
function render(prom){ function render(prom){
@ -30,9 +29,6 @@ angular.module('ffhb')
$scope.passphraseUpdate = function(){ $scope.passphraseUpdate = function(){
if($rootScope.passphrase !== undefined && $rootScope.passphrase !== '' && $rootScope.passphrase !== '*****'){ AuthenticationService.SetCredentials('client',$scope.passphrase);
console.log("set new basicauth");
AuthenticationService.SetCredentials('client',$rootScope.passphrase);
}
}; };
}); });

View File

@ -133,7 +133,7 @@ angular.module('ffhb')
result.resolve(true); result.resolve(true);
myservice.refresh(true); myservice.refresh(true);
},function(){ },function(){
$rootScope.passphrase = ''; $rootScope.globals.passphrase = '';
}); });
}else{ }else{
result.resolve(false); result.resolve(false);