1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

feat(authentication): add a --no-auth flag to disable authentication (#553)

This commit is contained in:
Anthony Lapenna 2017-02-01 22:13:48 +13:00 committed by GitHub
parent 779fcf8e7f
commit 10f7744a62
16 changed files with 203 additions and 191 deletions

View file

@ -1,5 +1,5 @@
angular.module('portainer.services')
.factory('StateManager', ['$q', 'Info', 'InfoHelper', 'Version', 'LocalStorage', function StateManagerFactory($q, Info, InfoHelper, Version, LocalStorage) {
.factory('StateManager', ['$q', 'Config', 'Info', 'InfoHelper', 'Version', 'LocalStorage', function StateManagerFactory($q, Config, Info, InfoHelper, Version, LocalStorage) {
'use strict';
var state = {
@ -9,12 +9,31 @@ angular.module('portainer.services')
};
return {
init: function() {
initialize: function() {
var endpointState = LocalStorage.getEndpointState();
if (endpointState) {
state.endpoint = endpointState;
}
state.loading = false;
var deferred = $q.defer();
var applicationState = LocalStorage.getApplicationState();
if (applicationState) {
state.application = applicationState;
state.loading = false;
deferred.resolve(state);
} else {
Config.$promise.then(function success(data) {
state.application.authentication = data.authentication;
state.application.logo = data.logo;
LocalStorage.storeApplicationState(state.application);
state.loading = false;
deferred.resolve(state);
}, function error(err) {
state.loading = false;
deferred.reject({msg: 'Unable to retrieve server configuration', err: err});
});
}
return deferred.promise;
},
clean: function() {
state.endpoint = {};