From 5f10149b2af9d0ff756635ac638f2a1bfe405ae6 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Mon, 11 Jul 2016 16:24:51 +0200 Subject: [PATCH] fix auth --- public/app/app.js | 1 - public/app/main.jade | 2 +- public/app/main.js | 12 ++++-------- public/components/store.js | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/public/app/app.js b/public/app/app.js index 7e85345..d345e78 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -21,7 +21,6 @@ angular.module('ffhb', [ amMoment.changeLocale('de'); $rootScope.globals = $cookieStore.get('globals') || {}; if ($rootScope.globals.currentUser) { - $rootScope.passphrase = '*****'; $http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line } }); diff --git a/public/app/main.jade b/public/app/main.jade index 34ea23b..89dcb7c 100644 --- a/public/app/main.jade +++ b/public/app/main.jade @@ -21,6 +21,6 @@ a.btn.btn-link(ng-click="refresh()") span.glyphicon.glyphicon-refresh(aria-hidden="true") | {{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") div(ui-view="",style="margin-top:100px;") diff --git a/public/app/main.js b/public/app/main.js index 088c8d8..34db175 100644 --- a/public/app/main.js +++ b/public/app/main.js @@ -1,13 +1,12 @@ 'use strict'; angular.module('ffhb') - .controller('MainCtrl',function($rootScope,$scope,$interval,store,$state,AuthenticationService){ + .controller('MainCtrl',function($scope,$interval,store,$state,AuthenticationService){ $scope.isOpen = false; $scope.$state = $state; $scope.refresh = store.refresh; - if($rootScope.passphrase === undefined){ - $rootScope.passphrase = ''; - } + $scope.passphrase = ''; + var timediff = new Date(1970,1,1); function render(prom){ @@ -30,9 +29,6 @@ angular.module('ffhb') $scope.passphraseUpdate = function(){ - if($rootScope.passphrase !== undefined && $rootScope.passphrase !== '' && $rootScope.passphrase !== '*****'){ - console.log("set new basicauth"); - AuthenticationService.SetCredentials('client',$rootScope.passphrase); - } + AuthenticationService.SetCredentials('client',$scope.passphrase); }; }); diff --git a/public/components/store.js b/public/components/store.js index 08cefe3..d1f97ac 100644 --- a/public/components/store.js +++ b/public/components/store.js @@ -133,7 +133,7 @@ angular.module('ffhb') result.resolve(true); myservice.refresh(true); },function(){ - $rootScope.passphrase = ''; + $rootScope.globals.passphrase = ''; }); }else{ result.resolve(false);