Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
compileUrl: function(config, url, fillSessionId) {
// Acquire cookie values.
var cstlUrl = $cookieStore.get(CstlConfig['cookie.cstl.url']),
domainId = $cookieStore.get(CstlConfig['cookie.domain.id']),
userId = $cookieStore.get(CstlConfig['cookie.user.id']);
// Inject cstl-service webapp url.
if (angular.isDefined(cstlUrl)) {
url = url.replace(CstlConfig['inject.expr.ctrl.url'], cstlUrl);
if(config){
config.headers.access_token = $.cookie(CstlConfig['cookie.auth.token']);
}
}else if (/@cstl/.test(url)){
window.location.href="index.html";
}
// Inject domain id value.
if (angular.isDefined(domainId)) {
url = url.replace(CstlConfig['inject.expr.domain.id'], domainId);
}
compileUrl: function(url, fillSessionId) {
// Acquire cookie values.
var cstlUrl = $cookies[CstlConfig['cookie.cstl.url']],
domainId = $cookies[CstlConfig['cookie.domain.id']],
userId = $cookies[CstlConfig['cookie.user.id']],
sessionId = $cookies[CstlConfig['cookie.session.id']];
// Inject cstl-service webapp url.
if (angular.isDefined(cstlUrl)) {
url = url.replace(CstlConfig['inject.expr.ctrl.url'], cstlUrl);
}
// Inject domain id value.
if (angular.isDefined(domainId)) {
url = url.replace(CstlConfig['inject.expr.domain.id'], domainId);
}
// Inject user id value.
if (angular.isDefined(userId)) {
url = url.replace(CstlConfig['inject.expr.user.id'], userId);
AppConfigService.getConfig(function(config) {
$scope.cstlURL = config.cstl;
$cookieStore.put('cstlUrl', $scope.cstlURL, {});
$scope.cstlLoginUrl = config.cstlLoginURL || 'login.html';
// default domain
$cookieStore.put(CstlConfig['cookie.domain.id'], '1', {});
Account.get({},function(response) {
//already authenticated, redirect to administration page
window.location.href="admin.html";
});
});
})
clear: function(){
$.removeCookie(CstlConfig['cookie.auth.token'], { path: '/' });
$.removeCookie(CstlConfig['cookie.user.id'], { path: '/' });
$.removeCookie(CstlConfig['cookie.domain.id'], { path: '/' });
}
};