/*************************************************
 * Copyright (c) 2016 Ansible, Inc.
 *
 * All Rights Reserved
 *************************************************/

import {templateUrl} from '../shared/template-url/template-url.factory';
import { N_ } from '../i18n';
import _ from 'lodash';

export default {
	name: 'license',
	route: '/license',
	templateUrl: templateUrl('license/license'),
	controller: 'licenseController',
	data: {},
	ncyBreadcrumb: {
		parent: 'setup',
		label: N_('LICENSE')
	},
    onEnter: ['$state', 'ConfigService', (state, configService) => {
        return configService.getConfig()
            .then(config => {
                return _.get(config, 'license_info.license_type') === 'open' && state.go('setup');
            });
    }],
	resolve: {
		features: ['CheckLicense', '$rootScope',
			function(CheckLicense, $rootScope) {
				if($rootScope.licenseMissing === undefined){
					return CheckLicense.notify();
				}

		}],
		config: ['ConfigService', 'CheckLicense', '$rootScope',
			function(ConfigService, CheckLicense, $rootScope) {
				ConfigService.delete();
	            return ConfigService.getConfig()
					.then(function(config){
						$rootScope.licenseMissing = (CheckLicense.valid(config.license_info) === false) ? true : false;
						return config;
					});
			}]
	},
};

@@ -653,23 +653,20 @@
         
-return 
+if (
 _.get(co
@@ -714,11 +714,38 @@
 pen'
- &&
+) %7B%0A                    return
  sta
@@ -760,16 +760,34 @@
 etup');%0A
+                %7D%0A
         

Fix route protection that led to infinite redirect