mirror of https://github.com/portainer/portainer
fix(app): rewrite URLHelper to avoid an issue with minification
parent
7643f8d08c
commit
2ef8c0b33e
|
@ -1,6 +1,10 @@
|
||||||
angular.module('portainer.app').service('urlHelper', function urlHelper($window) {
|
angular.module('portainer.app')
|
||||||
this.getParameter = getParameter;
|
.factory('URLHelper', ['$window', function URLHelperFactory($window) {
|
||||||
this.cleanParameters = cleanParameters;
|
'use strict';
|
||||||
|
var helper = {};
|
||||||
|
|
||||||
|
helper.getParameter = getParameter;
|
||||||
|
helper.cleanParameters = cleanParameters;
|
||||||
|
|
||||||
function getParameter(param) {
|
function getParameter(param) {
|
||||||
var parameters = extractParameters();
|
var parameters = extractParameters();
|
||||||
|
@ -21,4 +25,6 @@ angular.module('portainer.app').service('urlHelper', function urlHelper($window)
|
||||||
function cleanParameters() {
|
function cleanParameters() {
|
||||||
$window.location.search = '';
|
$window.location.search = '';
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
return helper;
|
||||||
|
}]);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
angular.module('portainer.app').controller('AuthenticationController', ['$q', '$scope', '$state', '$stateParams', '$sanitize', 'Authentication', 'UserService', 'EndpointService', 'StateManager', 'Notifications', 'SettingsService', 'urlHelper',
|
angular.module('portainer.app').controller('AuthenticationController', ['$q', '$scope', '$state', '$stateParams', '$sanitize', 'Authentication', 'UserService', 'EndpointService', 'StateManager', 'Notifications', 'SettingsService', 'URLHelper',
|
||||||
function($q, $scope, $state, $stateParams, $sanitize, Authentication, UserService, EndpointService, StateManager, Notifications, SettingsService, urlHelper) {
|
function($q, $scope, $state, $stateParams, $sanitize, Authentication, UserService, EndpointService, StateManager, Notifications, SettingsService, URLHelper) {
|
||||||
$scope.logo = StateManager.getState().application.logo;
|
$scope.logo = StateManager.getState().application.logo;
|
||||||
|
|
||||||
$scope.formValues = {
|
$scope.formValues = {
|
||||||
|
@ -105,7 +105,7 @@ angular.module('portainer.app').controller('AuthenticationController', ['$q', '$
|
||||||
authenticatedFlow();
|
authenticatedFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
var code = urlHelper.getParameter('code');
|
var code = URLHelper.getParameter('code');
|
||||||
if (code) {
|
if (code) {
|
||||||
oAuthLogin(code);
|
oAuthLogin(code);
|
||||||
} else {
|
} else {
|
||||||
|
@ -116,7 +116,7 @@ angular.module('portainer.app').controller('AuthenticationController', ['$q', '$
|
||||||
function oAuthLogin(code) {
|
function oAuthLogin(code) {
|
||||||
return Authentication.OAuthLogin(code)
|
return Authentication.OAuthLogin(code)
|
||||||
.then(function success() {
|
.then(function success() {
|
||||||
urlHelper.cleanParameters();
|
URLHelper.cleanParameters();
|
||||||
$state.go('portainer.home');
|
$state.go('portainer.home');
|
||||||
})
|
})
|
||||||
.catch(function error() {
|
.catch(function error() {
|
||||||
|
|
Loading…
Reference in New Issue