'use strict'; var ngAuthSettings = { uiBaseUri: '', siteRoot: '', apiBaseEndPoint: '', serviceBaseEndPoint: '', authServerUri: '' }; angular.element(document).ready(function () { var startupApp = angular.module('startupApp', []).provider({ $rootElement: function () { this.$get = function () { return angular.element('
'); }; } }); startupApp.constant('ngAuthSettings', ngAuthSettings); startupApp.factory('tokenManager', tokenManager); startupApp.factory('httpRequestInterceptor', httpRequestInterceptor); startupApp.factory('httpResponseInterceptor', httpResponseInterceptor); startupApp.config(function ($httpProvider) { $httpProvider.interceptors.push('httpResponseInterceptor'); $httpProvider.interceptors.push('httpRequestInterceptor'); }); var initInjector = angular.injector(['ng', 'ngCookies', 'startupApp']); var $http = initInjector.get("$http"); function callService(callback) { $http.get("../backend/configuration/get").then(function (configData) { ngAuthSettings.authServerUri = configData.data.authServerUri; ngAuthSettings.uiBaseUri = configData.data.baseUri; ngAuthSettings.siteRoot = configData.data.rootUri; ngAuthSettings.legacy = configData.data.legacyUri; ngAuthSettings.apiBaseEndPoint = configData.data.apiUri; ngAuthSettings.serviceBaseEndPoint = configData.data.serviceUri; if (typeof callback === "function") callback(); }); } callService(function () { angular.bootstrap(document, ['fengAuth']); }); }); var appAuth = angular.module('fengAuth', ['ngRoute', 'ngSanitize', 'ngCookies', 'ngMessages']) //ngSanitize required to allow binding to html. see forgotten.html .run(function (ngAuthSettings, $location, $rootScope, $window) { $rootScope.$on('$routeChangeSuccess', function (event, route) { if (route.params.auth && route.$$route.controller !== 'launchProductController') { var url = ngAuthSettings.uiBaseUri + 'login/urlAuthenticate?token=' + route.params.auth; $window.location.replace(url); } }); }) .config(function ($routeProvider, $locationProvider, $httpProvider) { $httpProvider.interceptors.push('httpResponseInterceptor'); $httpProvider.interceptors.push('httpRequestInterceptor'); //initialize get if not there if (!$httpProvider.defaults.headers.get) { $httpProvider.defaults.headers.get = {}; } //disable IE ajax request caching $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; // extra $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; $httpProvider.defaults.headers.get['Pragma'] = 'no-cache'; $locationProvider.html5Mode({ enabled: true }); $routeProvider .when('/', { templateUrl: 'views/landing.html', controller: 'loginController', caseInsensitiveMatch: true }) .when('/cookie', { templateUrl: 'views/cookie.html', caseInsensitiveMatch: true }) .when('/terms', { templateUrl: 'views/terms.html', caseInsensitiveMatch: true }) .when('/contact', { templateUrl: 'views/contact.html', caseInsensitiveMatch: true }) .when('/costCode', { templateUrl: 'views/costCode.html', caseInsensitiveMatch: true }) .when('/demo', { templateUrl: 'views/contact.html', caseInsensitiveMatch: true }) .when('/forgotten', { templateUrl: 'views/forgotten.html', caseInsensitiveMatch: true }) .when('/requestReset', { templateUrl: 'views/requestPasswordReset.html', caseInsensitiveMatch: true }) .when('/passwordReset', { templateUrl: 'views/PasswordReset.html', caseInsensitiveMatch: true }) .when('/expired', { templateUrl: 'views/expired.html', caseInsensitiveMatch: true }) .when('/privacy', { templateUrl: 'views/privacy.html', caseInsensitiveMatch: true }) .when('/resetRememberMe', { templateUrl: 'views/resetRememberMe.html', controller: 'resetRememberMeController', caseInsensitiveMatch: true }) .when('/loggedOut', { templateUrl: 'views/loggedOut.html', controller: 'loggedOutController', caseInsensitiveMatch: true }) .when('/loadProduct', { templateUrl: 'views/launchProduct.html', controller: 'launchProductController', caseInsensitiveMatch: true }) .when('/download', { templateUrl: 'views/launchDownload.html', controller: 'launchDownloadController', caseInsensitiveMatch: true }) .when('/urlAuthenticate', { templateUrl: 'views/authenticateFromUrl.html', controller: 'loginFromUrlController', caseInsensitiveMatch: true }) .when('/trialExpired', { templateUrl: 'views/trialExpired.html', controller: 'trialExpiredController', caseInsensitiveMatch: true }) .when('/productNotFound', { templateUrl: 'views/productNotFound.html', controller: 'trialExpiredController', caseInsensitiveMatch: true }) .when('/shibDisco', { templateUrl: 'views/shibboleth/shibDisco.html', caseInsensitiveMatch: true }) .when('/samlDisco', { templateUrl: 'views/shibboleth/samlDisco.html', caseInsensitiveMatch: true }) .when('/loginExternalTest', { templateUrl: 'views/loginExternal/loginExternalTest.html', controller: 'loginExternalTestController', caseInsensitiveMatch: true }) .when('/loginPartnerTest', { templateUrl: 'views/loginExternal/partnerLoginTest.html', controller: 'loginPartnerTestController', caseInsensitiveMatch: true }) .otherwise({ redirectTo: '/' }); }); appAuth.constant('ngAuthSettings', ngAuthSettings); appAuth.factory('tokenManager', tokenManager); appAuth.factory('httpRequestInterceptor', httpRequestInterceptor); appAuth.factory('httpResponseInterceptor', httpResponseInterceptor); appAuth.factory('authenticationService', authenticationService); appAuth.factory('costCodeService', costCodeService); appAuth.factory('userSettingsService', userSettingsService); appAuth.factory('launchDownloadService', launchDownloadService); appAuth.factory('productService', productService); appAuth.factory('searchModelService', searchModelService); appAuth.factory('clauseFilterProcessorFactory', clauseFilterProcessorFactory); appAuth.factory('searchResultsService', searchResultsService); appAuth.factory('documentStoreService', documentStoreService); appAuth.factory('WizardService', wizardService); appAuth.factory('scmProviderService', scmProviderService); appAuth.factory('viewService', viewService); appAuth.factory('trackingService', trackingService); appAuth.directive('selectAllTextOnFocus', selectAllTextOnFocus); appAuth.directive('autoFocus', autoFocus); //WebFont.load({ // custom: { // families: ['FontAwesome:n4'], // urls: ['../css/vendor/font-awesome.min.css'], // testStrings: { // 'FontAwesome': '\uf240' // } // }, // active: function () { // }, // inactive: function () { // var linkElement = document.createElement("link"); // linkElement.rel = "stylesheet"; // linkElement.href = "../css/fallback.css"; //Replace here // document.head.appendChild(linkElement); // } //});